BaseAuth
This class is an interface, it shouldn't be created directly.
Members
The application that this object is associated with.
endpoint : string
endpoint : stringThe Vulos Identity server endpoint URL.
Methods
constructor(application, endpoint?)
constructor(application, endpoint?)This should only get called by classes that inherit the BaseAuth class.
applicationshould be an instance of theApplicationobject.endpointshould be a string or afalsevalue (likenullorundefined) 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()
async connect()Connect the authentication object to the Vulos Identity servers.
This should get called before any other functions.
await auth.connect()createVerifier()
createVerifier()Create a verifier that other functions would take as an argument (as authVerifier).
It's recommended create one verifier per authentication request.
const verifier = auth.createVerifier()async createAuthUrl(authVerifier)
async createAuthUrl(authVerifier)Create an authentication/consent URL for a user.
const url = await auth.createAuthUrl(verifier)
// redirect the user to the URLasync processCallback(authVerifier, params)
async processCallback(authVerifier, params)Process the callback URL query parameters (or fragment parameters if using the implicit flow) to get a User object.
// 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)
async getUserInfo(accessToken)Get an UserInfo object using an access token provided by OpenID.
const userInfo = await auth.getUserInfo()This probably shouldn't get called directly, use User.info() instead.
async refreshTokens(refreshToken)
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.
Last updated