Exchange Code For An Access Token

To obtain an access token, make an HTTP GET request to this LaunchKey OAuth endpoint.

Request

End Point

Method:GET
URI:https://oauth.launchkey.com/access_token

Required Parameters

client_id:Service Key of your Service. This is found on the Keys tab of your Service details in the LaunchKey Dashboard.
client_secret:The unique secret key found on your Service settings page. Ensure this remains completely secret!
redirect_uri:The URI a user will be redirected to after authorization. This URI will capture the access token and store the token along with the user's login status.
code:Unique string received from the Login dialogue redirect.

Warning

Your Secret Key, which is used for the OAuth client_secret, should never be included in any client-side code or within binaries that could be decompiled. To ensure your service is secure, it is extremely important that the Secret Key remains completely secret.

Example

GET https://oauth.launchkey.com/access_token?client_id=1234567890&client_secret=YOUR_SECRET_KEY&redirect_uri=REDIRECT_PAGE_URL&code=AUTHORIZATION_CODE&grant_type=authorization_code HTTP/1.1
host: oauth.launchkey.com

Response

If successful, the response will have the status code of 200 and a JSON object in the body with the attributes specified below.

Attributes

access_token:The authenticating element for a user's session
token_type:Bearer
expires_in:Seconds until expiration
refresh_token:Used to refresh session and get a new access_token without going through the entire authorization flow again
user:Unique code identifying a specific user; this code will always be the same for that particular LaunchKey user

Example

{
    "access_token": "ACCESS_TOKEN",
    "token_type": "Bearer",
    "expires_in": 3600,
    "user": "USER_HASH",
    "refresh_token": "REFRESH_TOKEN"
}

User Contributed

LaunchKey links to user contributed code as a resource to its community. LaunchKey does not in any way guarantee or warrant the quality and security of these code bases. User contributed code is supported by the creators. If you do find a link from the site to user contributed code that is malicious or inappropriate in any way, please report that link to LaunchKey immediately and we will investigate the claim. Submit any issue to LaunchKey support at https://launchkey.com./support. ×