Approval API
The Approval API allows you to get approval from user to get user data or perform an action on behalf of the user.
The approval model
The approval model contains the url to which you should redirect the user to get approval. and a code will be sent which is valid for 5 minutes. The user can approve or reject the request. If the user approves the request, the code will be exchanged for an access token.
Properties
- Name
url
- Type
- string
- Description
The URL to redirect the user to get approval.
- Name
code
- Type
- string
- Description
The code to use to get approval. This code is valid for 5 minutes.
- Name
bearerToken
- Type
- string
- Description
The token that is sent after the user approves the request.
- Name
userId
- Type
- string
- Description
The user id of the user who approved the request.
Get approval url
This endpoint allows you to get the approval url to redirect the user to get approval.
Required attributes
- Name
clientId
- Type
- string
- Description
The client id of the user.
- Name
scope
- Type
- string[]
- Description
The scope of permissions to request from the user.
Request
curl -G https://api.metastore.to/v1/getURL \
-H "Authorization: Bearer {token}" \
-d clientId=124543213 \
-d scope=['profile', 'online status']
Response
{
"url": "https://api.metastore.to/v1/approval/redirect?code=123456789",
"code": "123456789"
}
Get approval result
This endpoint allows you to get the approval result after the user approves the request.
Required attributes
- Name
clientId
- Type
- string
- Description
The client id of the user.
- Name
code
- Type
- string
- Description
The code which is sent in the get approval url api response.
Request
curl https://api.metastore.to/v1/getResult \
-H "Authorization: Bearer {token}" \
-d clientId="12321321" \
-d code="18007593000" \
Response
{
"bearerToken": "123456789",
"userId": "123456789"
}