-
Notifications
You must be signed in to change notification settings - Fork 3
Service: OAuth2 Token Request with Authorization Code Grant
OAuth2 token request with authorization code grant requires an authorization code. A client can obtain an authorization code by sending an authorization request to KorAP authorization server.
This service requires client authentication for confidential clients. Client credentials should be included either in Authorization header or in the request body.
Available in: full version
Method: POST
Service URL: root/oauth2/token
| Name | Required | Description | Value |
|---|---|---|---|
| Authorization | yes, for confidential clients | Client authentication with HTTP Basic Authentication mechanism. Alternatively without Authorization header, client credentials can be specified in the request body. Client authentication is required for confidential clients. | client_id:client_secret encoded in Base64 |
| Content-Type | yes | content type of the input data | application/x-www-form-urlencoded |
URL-encoded form parameters
| Name | Required | Description | Type | Values |
|---|---|---|---|---|
| grant_type | yes | The OAuth2 grant type. | String | authorization_code |
| client_id | yes | The client identifier. | String | client_id given on client registration |
| client_secret | yes, for confidential clients | The client secret. Specify either in the Authorization header or the request body. Client authentication is required for confidential clients. | String | client_secret given on client registration |
| code | yes | An authorization code. | String | the authorization code obtained from authorization request |
| redirect_uri | yes, if included in the authorization request | The client's redirect URI where it receives the authorization code. It must be the same as the one registered on client registration. | String |
Example Client
| Credentials | Value |
|---|---|
| Client id | dRJnpFH6RHTr6L7bNhrn7F |
| Client secret | _IGaQqvUUrPTzRKJvqPYnA |
Authorization header
-
Scheme :
Basic -
Value: Base64 encoding for client_id:client_secret
ZFJKbnBGSDZSSFRyNkw3Yk5ocm43RjpfSUdhUXF2VVVyUFR6UktKdnFQWW5B
Authorization code grant with client authentication via Authorization header
curl -H 'Content-Type: application/x-www-form-urlencoded'
-H 'Authorization: Basic ZFJKbnBGSDZSSFRyNkw3Yk5ocm43RjpfSUdhUXF2VVVyUFR6UktKdnFQWW5B'
-d 'grant_type=authorization_code
&client_id=dRJnpFH6RHTr6L7bNhrn7F
&redirect_uri=http://example.client.com/redirect
&code=f351f1d6e135eff23aab1839e953'
http://localhost:8089/api/oauth2/token
Authorization code grant with client credentials in the request body
curl -H 'Content-Type: application/x-www-form-urlencoded'
-d 'grant_type=authorization_code
&client_id=dRJnpFH6RHTr6L7bNhrn7F
&client_secret=_IGaQqvUUrPTzRKJvqPYnA
&redirect_uri=http://example.client.com/redirect
&code=f351f1d6e135eff23aab1839e953'
http://localhost:8089/api/oauth2/token
Response
{
"access_token": "4dcf8784ccfd26fac9bdb82778fe60e2",
"refresh_token" : "hlWci75xb8atDiq3924NUSvOdtAh7Nlf9z",
"scope": "search match_info",
"token_type": "Bearer",
"expires_in": 259200
}
- Setting LDAP
- Setting initial super client
- Setting a custom environment
- Setting resources for CLARIN FCS
- Disabling query rewrites
- Named virtual corpora
- Importing Kustvakt to Eclipse
- Installing Lombok
- Setting annotation processors
- Setting a test environment
- HTTP Basic Authentication
- OAuth2 authorization scopes
- OAuth2 authorization request
- OAuth2 token request
- OAuth2 token revocation
- OAuth2 client registration
- OAuth2 client info
- OAuth2 client deregistration
- OAuth2 client secret reset
- Plugin registration
- Plugin list (marketplace)
- Plugin installation
- Plugin uninstallation
- Installed plugin list
- VC creation and update
- VC deletion
- VC list
- VC info
- VC KoralQuery
- VC statistics
- VC statistics with KoralQuery