Skip to main content
The Deno 2 Release Candidate is here
Learn more
Go to Latest
class AuthorizationCodeGrant
import { AuthorizationCodeGrant } from "https://deno.land/x/oauth2_client@v0.3.0/src/authorization_code_grant.ts";

Implements the OAuth 2.0 authorization code grant.

See https://tools.ietf.org/html/rfc6749#section-4.1

Constructors

new
AuthorizationCodeGrant(client: OAuth2Client)

Methods

private
buildAccessTokenRequest(code: string, requestOptions?: RequestOptions): Request
private
validateAuthorizationResponse(url: URL, options: GetTokenOptions): { code: string; state?: string; }

Builds a URI you can redirect a user to to make the authorization request.

getToken(authResponseUri: string | URL, options?: GetTokenOptions): Promise<Tokens>

Parses the authorization response request tokens from the authorization server.

Usually you'd want to call this method in the function that handles the user's request to your configured redirectUri.