Stashbase
Environment Client

Whoami

Get information about the currently authenticated entity.

Get information about the currently authenticated entity. The entity can be either a user, environment account (environment_account) or service account (service_account).

Example

const stashbase = createEnvClient(process.env.STASHBASE_API_KEY)

const { data, error } = await stashbase.whoami()

// check for errors
if (error) {
  // handle error
} else {
  if (data.type === 'user') {
    // do something with the user
    console.log(data.data.email)
  } else if (data.type === 'service_account') {
    // do something with the service account
    console.log(data.data.access)
  } else if (data.type === 'environment_account') {
    // do something with the environment account
    console.log(data.data.project.name)
  }
}

On this page