OAuth2.0 v2 - Get Auth code
OAuth 2.0 - Get your authorization code
Use the authorize
method which will construct a URL and redirect to it. It will ask the user for permissions. The user will be able to sign up for a new account or to sign in with their existing account.
When the user has accepted, he is redirected to your application (using the redirect_uri) with the authorization code and the state passed as URL parameters.
Important:
- Must be called as GET call.
- The authorization code is valid for 30 seconds.
More information about this webservice can be found in our API reference.
Getting your first access_token using Qodex
Let's have a look at the steps to get your first user acccess_token
using Qodex. You'll need to have access to a user account in order to complete this flow. We recommend using a sample user created beforehand on https://account.withings.com.
Step 1

- Go to the Public API collection and click on
OAuth2.0 v2 - Get Auth Code
- Click the send button. Parameters in the URL will be filled automatically based on you environment variables.
- Select the
Code snippet
button from Qodex righthand side bar. - Copy the URL that was generated by Qodex by using your environment variables
Step 2

- Open the URL built in step 1 to your favorite web browser.
- Login with a user account. Follow the OAuth2.0 flow and authorize your application to access the user account.
Step 3

Your callbackURL is called at the end of the flow with the user authorization code passed as a parameter. Copy this code from the URL.
WARNING: the authorization code is valid for 30 seconds only, so once Step 3 is complete you should quickly proceed with Step 4 and 5.
Step 4

- Click Qodex environment menu item
- Select your active Withings environment
- Replace the code variable with the one you obtained in Step 3
- Don't forget to Save!
Step 5

- Go back to the Public API Integration Collection
- Select the
OAuth2.0 v2 - Get access token
request and click Send
If you managed to perform steps 3, 4 and 5 in less than 30s, then congratulations: you've generated a valid access_token
and refresh_token
for this user ! 🎉
Next time your access_token
expires, you just need to call the OAuth2.0 v2 - Get refresh token
request in order to refresh it.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
response_type | string | DO NOT CHANGE | |
client_id | string | Available on your developer dashboard https://developer.withings.com/dashboard/ | |
redirect_uri | string | Available on your developer dashboard https://developer.withings.com/dashboard/ | |
state | string | Randomly generated in the Pre-request script | |
scope | string | Available scopes on https://developer.withings.com/oauth2/ |