type t = {
grant_type : string; |
scope : Scopes.t list; |
code : string; |
client_id : string; |
client_secret : string option; |
redirect_uri : Uri.t; |
}
val make :
client:Client.t ->
grant_type:string ->
scope:Scopes.t list ->
redirect_uri:Uri.t ->
code:string ->
t
val to_body_string : t -> string
Creates the body for the token request
val of_body_string : string -> ( t, [> `Msg of string ] ) Stdlib.result
Parses a request body into a t
Notes
The Authorization Server MUST validate the Token Request as follows:
- Authenticate the Client if it was issued Client Credentials or if it uses another Client Authentication method, per Section 9.
- Ensure the Authorization Code was issued to the authenticated Client.
- Verify that the Authorization Code is valid.
- If possible, verify that the Authorization Code has not been previously used.
- Ensure that the redirect_uri parameter value is identical to the redirect_uri parameter value that was included in the initial Authorization Request. If the redirect_uri parameter value is not present when there is only one registered redirect_uri value, the Authorization Server MAY return an error (since the Client should have included the parameter) or MAY proceed without an error (since OAuth 2.0 permits the parameter to be omitted in this case).
- Verify that the Authorization Code used was issued in response to an OpenID Connect Authentication Request (so that an ID Token will be returned from the Token Endpoint).