Authorization code

After you obtain an authorization code, you can exchange this authorization code for an access token by issuing an HTTPS POST request to Optimizely's authorization server.

The examples below show an example request and a successful response. The response will include an access token (with a lifetime of two hours) as well as a refresh token that can be used to request more access tokens after the initial access token expires.

Definitions

Example POST request

POST https://app.optimizely.com/oauth2/token
  ?code=asdbawejksd
  &client_id=123
  &client_secret=iamverysecret
  &redirect_uri=http%3A%2F%2Fmyapplication.com
  &grant_type=authorization_code

Example JSON response

{
  "access_token": "abcdefghijklmnopqrstuvwxyz",
  "expires_in": 7200,
  "token_type": "bearer",
  "refresh_token": "1234567890abcdefghijklmnopqrstuvwxyz"
}

Did this page help you?