API routes for handling OAuth 2.0 authentication.
If you are setting up your application with OAuth 2.0 integration for the first time, read Getting Started with OAuth 2.0 before attempting to use the routes below.
query client_id: Application ID (required)
query client_secret: Application secret (required)
This route is made available to test successful authentication of an Application using a client id and client secret.
GET /v1/oauth2/test/app?client_id=:uuid&client_secret=:uuid
{
"meta": {},
"data": [],
"time": 0.0005359649658203125
}
GET /v1/oauth2/test/app?client_id=:uuid&client_secret=1234567890
{
"errors": [
{
"message": "Not authorized",
"code": 4010
}
]
}
This route is made available to test successful authentication of a user through OAuth within an Application.
Note: All requests made on behalf of a user must include a "Bearer" header
GET /v1/oauth2/test/app_as_user
Bearer <valid-token-string>
{
"meta": {},
"data": [],
"time": 0.000141143798828125
}
GET /v1/oauth2/test/app_as_user
Bearer <invalid-token-string>
{
"errors": [
{
"message": "OAuth authorization error.",
"code": 4012,
"reason": "access_denied"
}
]
}
form code:
form grant_type:
form client_id:
form redirect_uri:
Generate access token information from an authorization code
To successfully authenticate a SHIFT user through OAuth, this final step must be performed by your application server. Post the correct data and both an access token and a refresh token will be generated for your application.
OAuth token generation
POST /v1/oauth2/token
"code=Pepiu3gwUtMlog6HST8FLC2MmRIAGfnVwbGonctC&client_secret=f07fcf0d-609e-4746-928c-6af34931d3d6&grant_type=authorization_code&client_id=944a9ad3-948b-4675-916e-1262816fea57&redirect_uri=https%3A%2F%2Fgrapheffect.com%2Foauth2redirect"
{
"access_token": "NZADi3Baw3PrXED2m66LVripQLU8ZnrOWQzKJsr7",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "2KJaOtHQnHGofjc9iOPQic6YDSrQzO6xGCxFiMW1"
}
OAuth token generation failure
POST /v1/oauth2/token
"code=qwertyuiopasdfghjklzxcvbnm&client_secret=81eb16c8-8bd6-4f4f-b21d-04897c0831bd&grant_type=authorization_code&client_id=fe57ce38-f335-4728-9703-f2d5f1b9a012&redirect_uri=https%3A%2F%2Fgrapheffect.com%2Foauth2redirect"
{
"error": "invalid_grant"
}