Requesting Access
To access APIs secured through Nuts, callers need an access token issued by the OAuth2 Authorization Server of the API owner. This page describes how to acquire an access token.
Nuts supports 2 access token flows:
- In the service access token, which is a bearer-token type flow, the requesting system authenticates at the Authorization Server on behalf of the user.
- In the user access token flow, which is an authorization code-type flow, the end-user authenticates at the Authorization Server, after which the access token is issued to the requesting system.
Requesting Service Access Token
This section describes which value(s) need to be specified in the service access token request.
- In the request URL:
-
subjectID
: the ID of the local requester, which was provided by the Nuts node when the subject and its DIDs was created.
-
- In the request body:
-
authorization_server_url
: the OAuth2 issuer URL of the party that grants access, found in its DID document. -
scope
: specifies what resources the access token will give access to. This is specified by the use case. -
credentials
(optional): one or more credentials to provide to the authorization server that are not in the requester's wallet. This is typically used to provide anEmployeeCredential
to the authorization server. See the section below for how to provide this. -
token_type
(optional): by default, tokens are of type DPoP that mitigate token theft. Alternatively, theBearer
token type can be specified, but you'll be more vulnerable to MITM attacks.
-
Providing extraadditional credentials
The service access token request allows you to supply additionalcredentials to the request, that are not in the subject's wallet but required for authentication. For instance, an EmployeeCredential
that contains information about the current logged-in user for logging purposes. These credential don't need to be signed: in that case they will be "self-attested" (e.g., the EmployeeCredential
); the Verifiable Presentation's signature will provide authenticity. For instance:
Requesting User Access Token
User access tokens are issued based on a (human) end-user authenticating at the authorization server, instead of a system acting on behalf of the end-user. As this flow is currently not used by any Nuts use cases, it's not described here.