OAuth2
OAuth2 enables developers to build applications that utilize data from the StreamElements API.
Apply for OAuth2 credentials here.
Code samples are available here.
URL | Description |
---|---|
Authorization endpoint | |
Token endpoint | |
Token Revocation endpoint |
Authorization Code Grant
Description:
Parameter | Type | Required | Description |
---|---|---|---|
client_id | string | true | Your registered client ID |
redirect_uri | URI | true | Your registered redirect URI. |
response_type | string | true | this must be code |
scope | string | false | Space-separated list of scopes |
state | strinng | false | A unique token generated by your application. This value is echoed back in the response |
https://api.streamelements.com/oauth2/authorize?client_id=9d5422b8ff529d420&redirect_uri=https%3A%2F%2Foauth.it-really.rocks%2Fcallback&response_type=code&scope=channel%3Aread
When someone navigates to this URL, they will be authorized for the requested scopes. Once accepted they will be redirected to your redirect_uri, which will contain a code and state if specified.
https://oauth.it-really.rocks?code=hjqkweSNDSDQ2___12&state=ejlkqwj2u31u31i1
The code is now exchanged for a user access token by making a POST request to the token URL with the following payload.
client_id | Your registered client ID |
---|---|
client_secret | Your registered client Secret |
grant_type | This must be authorization_code |
code | The code from the OAuth callback. |
redirect_uri | Your registered redirect URI. |
{
"access_token": "5a30c9621f638600014af608123",
"token_type": "Bearer",
"expires_in": 604800,
"refresh_token": "ed7a57c4cfbb540e5a30c9621f6386000",
"scope": ""
}
Updated about a year ago