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
  • Interfaces
  • UserTokens
  • Members
  • api : BaseAuth
  • accessToken : string?
  • refreshToken : string?
  • idToken : string?
  • tokenType : string?
  • expiresAt : number?
  • organizationApi : OrganizationApi
  • profileApi : ProfileApi
  • Methods
  • constructor(api,tokens)
  • save()
  • async reference()
  • async info()
  • async getOrganizationMemberships()
  • async createOrganization(details)
  • async organizationSearch(search, amount, offset)
  • async getAccessToken()
  1. Reference
  2. Identity JavaScript SDK
  3. The Base Package
  4. Authentication

User

PreviousBaseAuthNextUserInfo

Last updated 3 years ago

Interfaces

UserTokens

interface UserTokens {
    accessToken: string, 
    refreshToken: string, 
    idToken: string,
    tokenType: string,
    expiresAt: number
}

Members

api :

The BaseAuth implementation that was used to create this object.

accessToken : string?

This user's OpenID access token.

refreshToken : string?

This user's OpenID refresh token.

idToken : string?

This user's OpenID identification token.

tokenType : string?

The type of the access token.

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)

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)

save()

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()

async reference()

const ref = await user.reference()

async info()

const userInfo = await user.info()

async getOrganizationMemberships()

for (const membership of await user.getOrganizationMemberships()) {
    // do something with the membership object
}

async createOrganization(details)

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)

The only difference is that this function doesn't throw, but returns false on failure.

async getAccessToken()

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()

organizationApi :

profileApi :

The api argument should be a implementation;

The tokens argument should be a token set that implements the interface.

See for more information.

Save the token set user to a serializable object that implements the interface.

Create a object that is associated with this user.

Get the object for this user.

Get all the objects for this user's organizations.

Create a new organization with a details object that implements the interface.

This function is an alias to .

BaseAuth
OrganizationApi
ProfileApi
BaseAuth
BaseAuth
UserReference
UserInfo
OrganizationMembership
UserTokens
UserTokens
OrganizationCreateDetails
User.profileApi.organizationSearch()