Skip to content

auth token

Hugo Melder edited this page Oct 17, 2020 · 5 revisions

Get Token From DeviceCode

  • Generate a DeviceCode
  • Poll the auth_server every 2 seconds to check if the DeviceCode is authorized.
  • If the DeviceCode is authorized within 300s / 5m a access_token and a refresh_token will be generated. The access_token lasts 604800s / 7 Days.

Example Request

Method

POST

Url

https://auth.tidal.com/v1/oauth2/token

Url-Encoded POST Parameter

client_id: {client_id}
device_code: {device_code}
grant_type: urn:ietf:params:oauth:grant-type:device_code
scope: r_usr+w_usr+w_sub

HTTP Basic Authorization

{client_id} : {client_secret}

Example Response (Pending)

{
  "status": 400,
  "error": "authorization_pending",
  "sub_status": 1002,
  "error_description": "Device Authorization [DeviceAuthorization(id=xxxxxxx, userCode={user_code}, deviceCode={device_code}, clientToken={client_id}, userId=0, scopes=r_usr+w_usr+w_sub, created=Fri Oct 13 19:46:12 UTC 2020, validUntil=Fri Oct 13 19:51:52 UTC 2020, authorized=null, used=null, lastCheck=Fri Oct 13 19:48:35 UTC 2020)] is not authorized yet"
}

Example Response (Successful)

{
  "access_token": {access_token},
  "refresh_token": {refresh_token},
  "token_type": "Bearer",
  "expires_in": 604800,
  "user": {
    "userId": 012345678,
    "email": null,
    "countryCode": "DE",
    "fullName": null,
    "firstName": null,
    "lastName": null,
    "nickname": null,
    "username": "test@example.com",
    "address": null,
    "city": null,
    "postalcode": null,
    "usState": null,
    "phoneNumber": null,
    "birthday": null,
    "gender": null,
    "imageId": null,
    "channelId": 0123,
    "parentId": 0,
    "acceptedEULA": true,
    "created": 0000000000000,
    "updated": 0000000000000,
    "facebookUid": 0,
    "appleUid": null,
    "newUser": false
  }
}

Get Token From RefreshToken

  • If your AccessToken has expired use the RefreshToken to get a new AccessToken
Method

POST

Url

https://auth.tidal.com/v1/oauth2/token

Url-Encoded POST Parameter

client_id: {client_id}
refresh_token: {refresh_token}
grant_type: refresh_token
scope: r_usr+w_usr+w_sub

HTTP Basic Authorization

{client_id} : {client_secret}

Example Response

{
  "access_token": {access_token},
  "token_type": "Bearer",
  "expires_in": 604800,
  "user": {
    "userId": 012345678,
    "email": null,
    "countryCode": "DE",
    "fullName": null,
    "firstName": null,
    "lastName": null,
    "nickname": null,
    "username": "test@example.com",
    "address": null,
    "city": null,
    "postalcode": null,
    "usState": null,
    "phoneNumber": null,
    "birthday": null,
    "gender": null,
    "imageId": null,
    "channelId": 0123,
    "parentId": 0,
    "acceptedEULA": true,
    "created": 0000000000000,
    "updated": 0000000000000,
    "facebookUid": 0,
    "appleUid": null,
    "newUser": false
  }
}

Get Token With CodeVerifier

  • Use the Response Code from the web-based authorization flow
Method

POST

Url

https://auth.tidal.com/v1/oauth2/token

Url-Encoded POST Parameter

client_id: {client_id}
code: {code}
redirect_uri: {redirect_uri}
code_verifier: {code_verifier}
client_unique_key: {client_unique_key} (optional)
grant_type: authorization_code
scope: r_usr+w_usr+w_sub

HTTP Basic Authorization

```{client_id} : {client_secret}`

Example Response

{
  "access_token": {access_token},
  "refresh_token": {refresh_token},
  "token_type": "Bearer",
  "expires_in": 604800,
  "user": {
    "userId": 012345678,
    "email": null,
    "countryCode": "DE",
    "fullName": null,
    "firstName": null,
    "lastName": null,
    "nickname": null,
    "username": "test@example.com",
    "address": null,
    "city": null,
    "postalcode": null,
    "usState": null,
    "phoneNumber": null,
    "birthday": null,
    "gender": null,
    "imageId": null,
    "channelId": 0123,
    "parentId": 0,
    "acceptedEULA": true,
    "created": 0000000000000,
    "updated": 0000000000000,
    "facebookUid": 0,
    "appleUid": null,
    "newUser": false
  }
}

Exchange User-AuthenticationToken With Token

Example Request

Method

POST

Url

https://auth.tidal.com/v1/oauth2/token

Url-Encoded POST Parameter

client_id: {client_id}
user_auth_token: {user_auth_token}
client_version: {client_version} (optional)
client_unique_key: {client_unique_key} (optional)
grant_type: user_auth_token
scope: r_usr+w_usr+w_sub

HTTP Basic Authorization

{client_id} : {client_secret}

TIDALAPI REST Documentation

Artists
Albums
Playlists
Tracks
Videos
Mixes
User
Get
Delete
Add
Pages
Search
Feed
Widevine
Authentication
Clone this wiki locally