Options
All
  • Public
  • Public/Protected
  • All
Menu

The request authentication context found on the Express request when OpenID Connect auth middleware is added to your application.

app.use(auth());

app.get('/profile', (req, res) => {
  const user = req.oidc.user;
  ...
})

Hierarchy

  • RequestContext

Index

Properties

Optional accessToken

accessToken: AccessToken

Credentials that can be used by an application to access an API.

See: https://auth0.com/docs/protocols/oidc#access-tokens

Optional idToken

idToken: string

The OpenID Connect ID Token.

See: https://auth0.com/docs/protocols/oidc#id-tokens

Optional idTokenClaims

idTokenClaims: IdTokenClaims

An object containing all the claims of the ID Token.

isAuthenticated

isAuthenticated: () => boolean

Method to check the user's authenticated state, returns true if logged in.

Type declaration

    • (): boolean
    • Returns boolean

Optional refreshToken

refreshToken: string

Credentials that can be used to refresh an access token.

See: https://auth0.com/docs/tokens/concepts/refresh-tokens

Optional user

user: object

An object containing all the claims of the ID Token with the claims specified in identityClaimFilter removed.

Methods

fetchUserInfo

  • fetchUserInfo(): Promise<UserinfoResponse>
  • Fetches the OIDC userinfo response.

    app.use(auth());
    
    app.get('/user-info', async (req, res) => {
      const userInfo = await req.oidc.fetchUserInfo();
      res.json(userInfo);
    })

    Returns Promise<UserinfoResponse>