Resource Owner Grant
Last updated
Last updated
The Password grant type is used by first-party clients to exchange a user's credentials for an access token. Since this involves the client asking the user for their password, it should not be used by third party clients. In this flow, the user's username and password are exchanged directly for an access token. The application acts on behalf of the user. Refer to OAuth 2.0 spec for more details.
The first step is to configure Client for Resource Owner Grant with secret and password grant type:
Client will act on behalf of the user, which means Access Policies should be configured for User, not for Client.
You can configure Client for JWT tokens, set token expiration and enable refresh token:
attribute
options
desc
auth.password.token_format
jwt
use access token in jwt format
auth.password.access_token_expiration
int (seconds)
token expiration time from issued at
auth.password.refresh_token
true/false
enable refresh_token
auth.password.secret_required
true/false
require client secret for token
Next step is to collect username & password and exchange username, password, client id and secret (if required) for Access Token.
Using Basic & form-url-encoded:
Or by JSON request:
If provided credentials are correct, you will get a response with the access token, user information and refresh token (if enabled):
You can use the access token in Authorization header for Aidbox API calls:
Aidbox creates a Session resource for each Access Token, which can be closed with a special endpoint DELETE /Session
with the token in the Authorization header:
Session is just a Resource and you can inspect and manipulate sessions by a standard Search & CRUD API. For example, to get all sessions: GET /Session