Skip to content
CtrlK

Authentication

All API requests require a valid access token in the Authorization header. viewneo supports two authentication methods: Personal Access Tokens and OAuth2.

The simplest way to authenticate. Generate a token in your viewneo account settings:

  1. Go to Settings > API in the CMS

API settings page with OAuth clients and Personal Access Tokens 2. Click Generate new token 3. Enter a description to identify the token 4. Click Save 5. Copy the token immediately — it is only displayed once

Use the token in your API requests:

Authorization: Bearer YOUR_ACCESS_TOKEN

For applications that act on behalf of users, use the OAuth2 authorization code flow.

In Settings > API, click Generate new client and configure:

  • Description — A label displayed to users during authorization
  • Redirect URL — The callback URL where the authorization code is sent

Redirect the user to the authorization endpoint:

https://cloud.viewneo.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code

After the user authorizes your application, they are redirected to your callback URL with an authorization code:

https://example.com/callback?code=AUTHORIZATION_CODE

Send a POST request to obtain the access token:

Terminal window
curl -X POST https://cloud.viewneo.com/oauth/token \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "authorization_code",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uri": "https://example.com/callback",
"code": "AUTHORIZATION_CODE"
}'

Response:

{
"token_type": "Bearer",
"expires_in": 1296000,
"access_token": "YOUR_ACCESS_TOKEN",
"refresh_token": "YOUR_REFRESH_TOKEN"
}

When the access token expires, use the refresh token to obtain a new one:

Terminal window
curl -X POST https://cloud.viewneo.com/oauth/token \
-H 'Content-Type: application/json' \
-d '{
"grant_type": "refresh_token",
"refresh_token": "YOUR_REFRESH_TOKEN",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
}'

Include the access token in all API requests:

Terminal window
curl -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
'https://cloud.viewneo.com/api/v1.0/playlist'