FrontendAuth

This class implements BaseAuth.

Members

client : any | null

An implementation specific OpenID connect client.

Interfaces

OpenIDTokenSet

interface OpenIDTokenSet {
    access_token: string,
    expires_at: number,
    token_type?: 'Bearer',
    id_token?: string,
    refresh_token?: string
}

Methods

This class overrides previously defined methods from BaseAuth.

async setRefreshTokenCallback(fn)

This function sets a refresh callback implementation for this object.

The fn argument must be a function that takes a refresh token (string) as an argument and returns a promise that contains an object that implements the OpenIDTokenSet interface.

import { IFrameRefresh } from '@vulos/identity-browser-sdk';

await auth.setRefreshTokenCallback(async function(refreshToken) {
    console.log(this) // this is the auth object
    if (refreshToken) {
        // refresh using a refresh token
    } else {
        throw new Error('Not supported')
    }
})

An iframe-based implementation is provided as IFrameRefresh.

Last updated