Options
All
  • Public
  • Public/Protected
  • All
Menu
description

The OAuth controller of the app. Handles requests about third-party authentication using the OAuth standard.

These request handlers can be used to link OAuth-compatible third-party (remote) accounts such as a user's Strava or Apple Health account.

This controller defines the following routes:

URI HTTP method Class method Description
/oauth/:provider/authorize GET OAuthController.authorize Uses the AuthGuard to validate the required access token (Server cookie or Bearer authorization header). Redirects the user to the third-party provider OAuth Authorization URL for valid requests.
/oauth/:provider/callback GET OAuthController.callback Uses the AuthGuard to validate the required access token (Server cookie or Bearer authorization header). Requests an access token and refresh token from the third-party provider and finalizes the authorization process.
since

v0.3.0

Hierarchy

  • OAuthController

Index

Constructors

Methods

  • authorize(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, response: Response<any, Record<string, any>>, provider: string, query: OAuthAuthorizeRequest): Promise<void>
  • Request an authorization from a registered OAuth provider by redirecting the user to the provider authorization page.

    method

    GET

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>
    • response: Response<any, Record<string, any>>
    • provider: string
    • query: OAuthAuthorizeRequest

    Returns Promise<void>

  • callback(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, provider: string, query: OAuthCallbackRequest): Promise<StatusDTO>
  • getProfile(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>): Promise<ProfileDTO>
  • Requests a user's profile information. This endpoint is protected and a valid access token must be attached in the Authorization request header, in signed cookies or in browser cookies.

    The request is secured using the AuthGuard guard which attaches a payload to the request object.

    method

    GET

    access

    protected

    async

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

      An express request used to extract the authenticated user payload.

    Returns Promise<ProfileDTO>

    Promise An authenticated user's profile information ("account" information).

Generated using TypeDoc