POST restapi/oauth2/token
Get a new access token from either refresh_token, authorization_code or JWT bearer.
The request's Content-Type must be x-www-form-urlencoded.
The post should look like this on authorization request:
client_id=7abc00f3-32e6-4602-a784-c51b36d2798d&grant_type=authorization_code&code=1-53aa19e823514c1c936dc2a654ba30ec7cF3KUBGTqWhen refreshing the token, the post should look like this:
client_id=7abc00f3-32e6-4602-a784-c51b36d2798d&grant_type=refresh_token&refresh_token=1-53aa19e823514c1c936dc2a654ba30ec7cF3KUBGTqWhen requesting a server-to-server access token, the post should look like this:
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=...
Note that the grant_type should be "authorization_code" when doing the first request after getting authorization by the user. However, when refreshing the token, the grant_type should be "refresh_token". The token parameter is "code" on authorization, and "refresh_token" on refreshing access_token. In case of a server-to-server access token the grant_type should be "urn:ietf:params:oauth:grant-type:jwt-bearer".
Request Information
URI Parameters
None.
Body Parameters
None.
Response Information
Resource Description
The new access token and refresh token
Itsolutions.Itslearning.Web.RestApi.Personal.TokenResponseName | Description | Type | Additional information |
---|---|---|---|
access_token |
The accesstoken that's used for calling API |
string |
None. |
token_type |
The token type. Refer to OAuth2 specs for more detailed information |
string |
None. |
expires_in |
Seconds until expiry of the access token |
integer |
None. |
refresh_token |
The refresh_token, used for getting a new access token and refresh token pair after expiry. |
string |
None. |
Response Formats
application/json, text/json
{ "access_token": "WTwJWDdWq8aSY3DcBuuEI04rBzFC_L8ddnlzkm138KzxoiEKHU2bjVW-tg7tmaNfXxK1ToL8mUzLEzeL3WVDITiTL4AE5asyWwGE9-39HK6W-02VHMuh7k0T57H_q_Ck", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "1-a93f13a473ec45d7a24494cf9c9b27663Rw8M" }
application/xml, text/xml
<TokenResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Itsolutions.Itslearning.Web.RestApi.Personal"> <access_token>WTwJWDdWq8aSY3DcBuuEI04rBzFC_L8ddnlzkm138KzxoiEKHU2bjVW-tg7tmaNfXxK1ToL8mUzLEzeL3WVDITiTL4AE5asyWwGE9-39HK6W-02VHMuh7k0T57H_q_Ck</access_token> <expires_in>3600</expires_in> <refresh_token>1-a93f13a473ec45d7a24494cf9c9b27663Rw8M</refresh_token> <token_type>Bearer</token_type> </TokenResponse>