---
title: "OAuth 2.0 - Request Access and Refresh Tokens"
method: POST
path: "https://wbsapi.withings.net/v2/oauth2"
tags: ["oauth2"]
---

# OAuth 2.0 - Request Access and Refresh Tokens

`POST https://wbsapi.withings.net/v2/oauth2`

## Request

- Base URL: `https://wbsapi.withings.net`
- URL: `https://wbsapi.withings.net/https://wbsapi.withings.net/v2/oauth2`
- Auth: none declared

Use this endpoint to request an ```access token``` and ```refresh token``` from an ```authorization code``` or refresh an existing ```access token```.<br><br> <span class='oauth2-request-token-notes'> **Important:** Don't forget to save the userid included in the response in your database.<br><br> **Note:** You can use this webservice either by signing the call or using the secret. Toggle the request body schema to see the parameters for the 2 options.<br><br> **Note:** Toggle the ```grant_type``` to see the different parameters that must be used depending if you're refreshing a token or using an authorization code. </span>

## Request body `Using client secret`

- object
  - `action` string: Must take the value ```requesttoken```.

## Response `200`

(Click to unfold)

- object
  - `status` integer: Response status. See <a href='#tag/response_status'>Status</a> section for details.
  - `body` object: Response data.
    - `userid` integer: The id of the user.
    - `access_token` string: Your new Access Token.
    - `refresh_token` string: Your Refresh Token.
    - `expires_in` integer: Access token expiry delay in seconds.
    - `scope` string: You can get only the scope that the user accepted with the Token you have. Scopes can be 'user.info' 'user.metrics' 'user.activity' 'user.sleepevents' and must be separated by a coma.
    - `csrf_token` string
    - `token_type` string: HTTP Authorization Header format: Bearer

---

[API](https://skmtc.dev/withings/apis/withings-developer-documentation.md) - [All operations](https://skmtc.dev/withings/apis/withings-developer-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/withings/apis/withings-developer-documentation/revisions/9e9accd01d4b?raw)
