Vulos Documentation
  • Identity
    • Welcome to the Vulos Identity Documentation!
    • Quick Start
    • Organizations
    • Scopes and Claims
  • Reference
    • Identity JavaScript SDK
      • The Base Package
        • KYC
          • KycStatus
          • KycInstance
          • KycDetails
          • KycApi
        • Profile
          • UserReference
          • ProfileApi
        • Cache
        • Authentication
          • Application
          • BaseAuth
          • User
          • UserInfo
          • BaseApi
        • Organizations
          • Organization
          • OrganizationMembership
            • OrganizationMembershipWithMetadata
          • OrganizationRole
          • OrganizationApi
      • The Backend Auth Package
        • CodeVerifier
        • BackendAuth
      • The Frontend Auth Package
        • IFrameRefresh
        • StateVerifier
        • FrontendAuth
    • Organization API
      • Organizations
      • Memberships
        • Roles
    • Profile API
    • KYC API
Powered by GitBook
On this page
  • Members
  • application : Application
  • endpoint : string
  • Methods
  • constructor(application, endpoint?)
  • async connect()
  • createVerifier()
  • async createAuthUrl(authVerifier)
  • async processCallback(authVerifier, params)
  • async getUserInfo(accessToken)
  • async refreshTokens(refreshToken)
  1. Reference
  2. Identity JavaScript SDK
  3. The Base Package
  4. Authentication

BaseAuth

PreviousApplicationNextUser

Last updated 3 years ago

This class is an interface, it shouldn't be created directly.

Members

application :

The application that this object is associated with.

endpoint : string

The Vulos Identity server endpoint URL.

Methods

constructor(application, endpoint?)

This should only get called by classes that inherit the BaseAuth class.

  • application should be an instance of the object.

  • endpoint should be a string or a false value (like null or undefined) that represents the Vulos Identity endpoint.

// the constructor is called inside of the createAuth method of `Application`
import { BackendAuth } from "@vulos/identity-node-sdk"
const auth = applicaion.createAuth(BackendAuth)

async connect()

Connect the authentication object to the Vulos Identity servers.

This should get called before any other functions.

await auth.connect()

createVerifier()

Create a verifier that other functions would take as an argument (as authVerifier).

A verifier is an object that contains some value that will be used to verify if the server's response is valid.

It's recommended create one verifier per authentication request.

const verifier = auth.createVerifier()

async createAuthUrl(authVerifier)

Create an authentication/consent URL for a user.

const url = await auth.createAuthUrl(verifier)
// redirect the user to the URL

async processCallback(authVerifier, params)

// req is an object that is supposed to be a HTTP request in this example
const user = await auth.processCallback(verifier, req.query)

async getUserInfo(accessToken)

const userInfo = await auth.getUserInfo()

async refreshTokens(refreshToken)

Get a new OpenID token set using a refresh token.

const { access_token, refresh_token, id_token, token_type, expires_at} 
    = await auth.refreshTokens(refreshToken)

This probably shouldn't get called directly, it's called automatically when needed.

See for more information.

Process the callback URL query parameters (or fragment parameters if using the implicit flow) to get a object.

Get an object using an access token provided by OpenID.

This probably shouldn't get called directly, use instead.

Application
Application
Application
User
UserInfo
User.info()