{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/token","auth":"never","examples":{"codes":[{"name":"Initial Token","language":"php","code":"<?php\n\n$client = new GuzzleHttp\\Client();\n\ntry {\n\n  //if using Guzzle 6+ change \"body\" to \"form_params\"\n  $response = $client->post('https://streamlabs.com/api/v1.0/token', [\n    'body' => [\n      'grant_type'    => 'authorization_code',\n      'client_id'     => 'YOUR_CLIENT_ID',\n      'client_secret' => 'YOUR_CLIENT_SECRET',\n      'redirect_uri'  => 'YOUR_CLIENT_REDIRECT_URI',\n      'code'          => $_GET['code']\n    ]\n\t]);\n\n  $result = $response->json();\n\n} catch (Exception $e) {\n\n  //failed\n  $result = $e->getResponse()->json();\n\n}"},{"code":"<?php\n\n$client = new GuzzleHttp\\Client();\n\ntry {\n\n  //if using Guzzle 6+ change \"body\" to \"form_params\"\n  $response = $client->post('https://www.twitchalerts.com/api/v1.0/token', [\n    'body' => [\n      'grant_type'    => 'refresh_token',\n      'client_id'     => 'YOUR_CLIENT_ID',\n      'client_secret' => 'YOUR_CLIENT_SECRET',\n      'redirect_uri'  => 'YOUR_CLIENT_REDIRECT_URI',\n      'refresh_token' => 'REFRESH_TOKEN_HERE'\n    ]\n\t]);\n\n  $result = $response->json();\n\n} catch (Exception $e) {\n\n  //failed\n  $result = $e->getResponse()->json();\n\n}","name":"Refreshing A Token","language":"php"}]},"method":"post","params":[{"name":"grant_type","type":"string","default":"","desc":"The grant type of this request. Will be **authorization_code** or **refresh_token** depending on which is accompanying this request","required":true,"in":"body","ref":"","_id":"55baf6e31b0d663700781678"},{"name":"client_id","type":"string","default":"","desc":"The client_id of your application","required":true,"in":"body","ref":"","_id":"55bad720d0736b3100bf101d"},{"name":"client_secret","type":"string","default":"","desc":"The client_secret of your application","required":true,"in":"body","ref":"","_id":"55bad79d3f0767230008f514"},{"name":"redirect_uri","type":"string","default":"","desc":"The redirect_uri of your application","required":true,"in":"body","ref":"","_id":"55bad79d3f0767230008f515"},{"name":"code","type":"string","default":"","desc":"The code received from an /authorize response. Required if grant_type is **authorization_code**","required":false,"in":"body","ref":"","_id":"55baf6e31b0d663700781677"},{"name":"refresh_token","type":"string","default":"","desc":"The refresh_token received from a previous /token response. Required if grant_type is **refresh_token**","required":false,"in":"body","ref":"","_id":"55baf7aa1b0d66370078167c"}],"results":{"codes":[{"code":"{\n\taccess_token: 'loXk8FTOFwKfrLP3bGCnJldBxuGX03a03iQdxR8A',\n\ttoken_type: 'Bearer',\n\trefresh_token: 'IXCGDha46Q4eHBKrijmAqUwScbsMSuBy9IopXp80'\n}","language":"json","status":200,"name":"Success"},{"name":"Failure","code":"{\n  \"error\": \"...\",\n  \"message\": \"...\"\n}","language":"json","status":400}]},"settings":""},"next":{"description":"","pages":[]},"title":"/token","type":"endpoint","slug":"token","excerpt":"Once a user has given approval from the [/authorize](doc:authorize) endpoint, use this endpoint to receive an `access_token`.","body":"","updates":["5854b719959a530f0084ac72","5888ba3f62e5fe3d00373fe2","5899f2e0d775872500985986","5899f3fbe94a202500fa2d90","58ca0be3cffe542300df6d4c","58d8bc60450eb40f0094d3e2","58ed5ee67dbb5a2f00333833","58ed5f38afceeb2f00ce71f3","5930ffaba6bb48000f67e119"],"order":1,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"55baf6e31b0d663700781676","parentDoc":null,"__v":11,"editedParams":true,"createdAt":"2015-07-31T04:17:39.022Z","category":{"sync":{"isSync":false,"url":""},"pages":["55baf6961b0d663700781673","55baf6e31b0d663700781676"],"title":"Authentication","slug":"authentication","order":1,"from_sync":false,"reference":true,"_id":"55baf4151b0d66370078166f","version":"55baca9cd0736b3100bf100b","__v":2,"project":"55baca9cd0736b3100bf1008","createdAt":"2015-07-31T04:05:41.090Z"},"githubsync":"","project":"55baca9cd0736b3100bf1008","user":"55baca333f0767230008f4ff","editedParams2":true,"version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["55baca9dd0736b3100bf100c","55bacba0d0736b3100bf1017","55bad8f33f0767230008f517","55baf3f01b0d66370078166e","55baf4151b0d66370078166f","55f1cca35fe76419007dc794","573e2d6e610a090e00ca2b97","58d97ce57718211b0028e6bc","599b510cb683b50031a35299","5a871c493948fd004697e677"],"_id":"55baca9cd0736b3100bf100b","createdAt":"2015-07-31T01:08:44.540Z","project":"55baca9cd0736b3100bf1008","__v":10,"releaseDate":"2015-07-31T01:08:44.540Z"}}

post/token

Once a user has given approval from the [/authorize](doc:authorize) endpoint, use this endpoint to receive an `access_token`.

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

grant_type:
required
string
The grant type of this request. Will be **authorization_code** or **refresh_token** depending on which is accompanying this request
client_id:
required
string
The client_id of your application
client_secret:
required
string
The client_secret of your application
redirect_uri:
required
string
The redirect_uri of your application
code:
string
The code received from an /authorize response. Required if grant_type is **authorization_code**
refresh_token:
string
The refresh_token received from a previous /token response. Required if grant_type is **refresh_token**

Examples


Result Format