Exchange Authorization Code
AI-generatedOverview
This node operation exchanges an OAuth authorization code for access and refresh tokens from Withings. It is useful in OAuth workflows where you need to manually obtain tokens after the user authorizes the app. For example, after receiving an authorization code from the OAuth callback, this node exchanges it to get tokens for API access.
Use Case Examples
- After a user authorizes your Withings app and you receive an authorization code, use this node to exchange that code for access and refresh tokens to authenticate API requests.
- Use this node to manually refresh tokens if needed by switching to the refresh token operation.
Properties
| Name | Meaning |
|---|---|
| Client ID | Your Withings Client ID, used to identify the application during token exchange. |
| Client Secret | Your Withings Client Secret, used to authenticate the application during token exchange. |
| Redirect URI | The OAuth redirect URI that must match your Withings app settings, used during token exchange. |
| Authorization Code | The authorization code received from the OAuth callback, which is exchanged for tokens. |
Output
JSON
success- Indicates if the token exchange was successful.operation- The operation performed, here it is 'exchangeCode'.accessToken- The access token received from Withings for API authentication.refreshToken- The refresh token received to obtain new access tokens later.expiresIn- The lifetime in seconds of the access token.expiresAt- The UNIX timestamp when the access token expires.expiresAtReadable- The ISO 8601 formatted date and time when the access token expires.userId- The Withings user ID associated with the tokens.scope- The OAuth scopes granted with the tokens.
Dependencies
- Withings API endpoint URLs
Troubleshooting
- Common issues include invalid or expired authorization codes, mismatched redirect URIs, or incorrect client credentials.
- Errors like 'Token exchange failed' indicate the Withings API rejected the request; verify all parameters and credentials.
- Ensure the authorization code is fresh and not reused, as codes typically expire quickly.
Links
- Withings OAuth2 Token Exchange Documentation - Official documentation on exchanging authorization codes for tokens with Withings API.