User
interface UserTokens {
accessToken: string,
refreshToken: string,
idToken: string,
tokenType: string,
expiresAt: number
}
The
BaseAuth
implementation that was used to create this object.This user's OpenID access token.
This user's OpenID refresh token.
This user's OpenID identification token.
The type of the access token.
The time when the access token expires.
The
OrganizationApi
object that is associated with this user.The
ProfileApi
object that is associated with this user.Create a user object that interacts with the Vulos Identity API on behalf of a user.
const user = new User(auth, preservedTokenSet)
// ... or
const user = await auth.processCallback(verifier, req.query)
This function can be used if you want to store the user tokens in a database.
The tokens might update on any API call, so make sure you call this if you want to preserve the tokens.
const tokenSet = user.save()
const ref = await user.reference()
const userInfo = await user.info()
for (const membership of await user.getOrganizationMemberships()) {
// do something with the membership object
}
Create a new organization with a
details
object that implements the OrganizationCreateDetails
interface.const membership = await user.createOrganization({
name: 'My Organization',
website: 'https://example.com',
address: 'Example St. 1234',
uniqueId: '1234-567-89',
city: 'Example City',
countryCode: 'AQ',
zipCode: '1234',
// state: 'Optional State'
})
The only difference is that this function doesn't throw, but returns
false
on failure.Get the access token of the user.
This function will automatically attempt to refresh the access token if it is expired.
const accessToken = await getAccessToken()
Last modified 1yr ago