User
Interfaces
UserTokens
UserTokensinterface UserTokens {
accessToken: string,
refreshToken: string,
idToken: string,
tokenType: string,
expiresAt: number
}Members
The BaseAuth implementation that was used to create this object.
accessToken : string?
accessToken : string?This user's OpenID access token.
refreshToken : string?
refreshToken : string?This user's OpenID refresh token.
idToken : string?
idToken : string?This user's OpenID identification token.
tokenType : string?
tokenType : string?The type of the access token.
expiresAt : number?
expiresAt : number?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.
Methods
constructor(api,tokens)
constructor(api,tokens)Create a user object that interacts with the Vulos Identity API on behalf of a user.
The
apiargument should be aBaseAuthimplementation;The
tokensargument should be a token set that implements theUserTokensinterface.
const user = new User(auth, preservedTokenSet)
// ... or
const user = await auth.processCallback(verifier, req.query)save()
save()Save the token set user to a serializable object that implements the UserTokens interface.
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()async reference()
async reference()Create a UserReference object that is associated with this user.
const ref = await user.reference()async info()
async info()Get the UserInfo object for this user.
const userInfo = await user.info()async getOrganizationMemberships()
async getOrganizationMemberships()Get all the OrganizationMembership objects for this user's organizations.
for (const membership of await user.getOrganizationMemberships()) {
// do something with the membership object
}async createOrganization(details)
async createOrganization(details)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'
})async organizationSearch(search, amount, offset)
async organizationSearch(search, amount, offset) The only difference is that this function doesn't throw, but returns false on failure.
async getAccessToken()
async getAccessToken()Get the access token of the user.
const accessToken = await getAccessToken()Last updated