Withings Token Exchange icon

Withings Token Exchange

Manually exchange Withings authorization code for access and refresh tokens

Refresh Access Token

AI-generated

Overview

This node operation refreshes an expired Withings access token using a provided refresh token. It is useful in scenarios where the access token has expired and needs to be renewed to maintain authorized API access without requiring the user to re-authenticate. For example, it can be used in automated workflows to keep Withings API sessions active by periodically refreshing tokens.

Use Case Examples

  1. A user has an expired access token and wants to refresh it automatically using the stored refresh token.
  2. An automated system needs to maintain continuous access to Withings data by refreshing tokens before they expire.

Properties

Name Meaning
Client ID Your Withings Client ID, used to identify the application during the token refresh request.
Client Secret Your Withings Client Secret, used to authenticate the application during the token refresh request.
Refresh Token The refresh token to use for obtaining a new access token when the current one expires.

Output

JSON

  • success - Indicates if the token refresh operation was successful (true or false).
  • operation - The operation performed, which is 'refreshToken' in this case.
  • accessToken - The new access token obtained from the refresh operation.
  • refreshToken - The new refresh token obtained from the refresh operation.
  • expiresIn - The lifetime in seconds of the new access token.
  • expiresAt - The expiration time of the new access token as a Unix timestamp (seconds since epoch).
  • expiresAtReadable - The expiration time of the new access token in ISO 8601 date-time format.
  • userId - The Withings user ID associated with the tokens.
  • scope - The OAuth scopes granted with the new access token.

Dependencies

  • Requires Withings API credentials: Client ID and Client Secret for authentication.

Troubleshooting

  • Common issues include invalid or expired refresh tokens, which will cause the token refresh to fail. The node throws an error with a message indicating 'Token refresh failed' along with the API response details.
  • Ensure that the Client ID, Client Secret, and Refresh Token are correctly provided and valid.
  • Check network connectivity and Withings API availability if HTTP requests fail.

Links

Discussion