Skip to content
Docs
Reference

BackstageClient.me

BackstageClient.me in @ticketlayer/backstage.

@ticketlayer/backstage


@ticketlayer/backstage / BackstageClient / me

me: {
  current: (requestOptions?: RequestOptions) => Promise<{
     email: string;
     externalUserId?: string;
     firstName?: string;
     id: string;
     identityProvider?: string;
     lastName?: string;
  }>;
  grants: (requestOptions?: RequestOptions) => Promise<{
     client: {
        clientUri: string | null;
        id: string;
        logoUri: string | null;
        name: string;
     };
     expiresAt: string;
     grantedAt: string;
     id: string;
     integrationId: string | null;
     lastUsedAt: string;
     organisation:   | {
        id: string;
        name: string | null;
        slug: string | null;
      }
        | null;
     resources: string[];
     scopes: string[];
  }[]>;
  organisations: (requestOptions?: RequestOptions) => Promise<{
     id: string;
     logoUrl?: string;
     name: string;
     primaryColor?: string;
     secondaryColor?: string;
     slug: string;
     testMode: boolean;
     userId: string;
  }[]>;
  permissions: (options?: {
     action?: string;
     resource?: string;
   }, requestOptions?: RequestOptions) => Promise<{
     filters: {
        action: string | null;
        resource: string | null;
     };
     isOrgAdmin: boolean;
     permissions: {
        accounts: string[];
        isAllAccounts: boolean;
        permission: string;
     }[];
  }>;
  redeemInvitation: (request: {
     invitation: string;
   }, requestOptions?: RequestOptions) => Promise<{
     created: boolean;
     organisation: {
        id: string;
        name: string;
        slug: string;
     };
     userId: string;
  }>;
  revokeGrant: (grantId: string, requestOptions?: RequestOptions) => Promise<boolean>;
  roles: (requestOptions?: RequestOptions) => Promise<{
     isOrgAdmin: boolean;
     roles: {
        accountId: string;
        description: string | null;
        id: string;
        isSystemRole: boolean;
        name: string | null;
     }[];
  }>;
};

Defined in: client.ts:1672

Me methods

current()#

current: (requestOptions?: RequestOptions) => Promise<{
  email: string;
  externalUserId?: string;
  firstName?: string;
  id: string;
  identityProvider?: string;
  lastName?: string;
}>;

Get current user Get the currently authenticated user information

Parameters#

ParameterType
requestOptions?RequestOptions

Returns#

Promise<{ email: string; externalUserId?: string; firstName?: string; id: string; identityProvider?: string; lastName?: string; }>

Operation Id#

getCurrentUser

grants()#

grants: (requestOptions?: RequestOptions) => Promise<{
  client: {
     clientUri: string | null;
     id: string;
     logoUri: string | null;
     name: string;
  };
  expiresAt: string;
  grantedAt: string;
  id: string;
  integrationId: string | null;
  lastUsedAt: string;
  organisation:   | {
     id: string;
     name: string | null;
     slug: string | null;
   }
     | null;
  resources: string[];
  scopes: string[];
}[]>;

List my connected apps The signed-in person's own grants to third-party apps, in every organisation: the client, the organisation it acts in, the scopes, when it was granted and when it was last used. Sign-ins to Ticketlayer's own apps are not listed. Takes the person's own access token from the Ticketlayer identity issuer, pinned to an organisation or not, from one of Ticketlayer's own apps (403 FIRST_PARTY_CLIENT_REQUIRED for a third party's token acting for the person), and does not need X-Ticketlayer-Org.

Parameters#

ParameterType
requestOptions?RequestOptions

Returns#

Promise<{ client: { clientUri: string | null; id: string; logoUri: string | null; name: string; }; expiresAt: string; grantedAt: string; id: string; integrationId: string | null; lastUsedAt: string; organisation: | { id: string; name: string | null; slug: string | null; } | null; resources: string[]; scopes: string[]; }[]>

Operation Id#

listMyGrants

organisations()#

organisations: (requestOptions?: RequestOptions) => Promise<{
  id: string;
  logoUrl?: string;
  name: string;
  primaryColor?: string;
  secondaryColor?: string;
  slug: string;
  testMode: boolean;
  userId: string;
}[]>;

Get my organisations Every organisation the signed-in person is a member of that the calling app can be pinned to, and nothing about anyone else: the list an organisation picker shows. A membership held only as a Ticketlayer for Webflow client (the Webflow client role and no other) is managed in the Webflow Designer and is listed to the Designer's own client alone. Takes the person's own access token from the Ticketlayer identity issuer, whether or not it is pinned to an organisation, and does not need X-Ticketlayer-Org: a sign-in that named no organisation, for a person who belongs to several, answers a token pinned to none, and this is how that person finds out which there are to choose from. Pin the session to one (the token exchange, selectOrganisation in the SDK) before calling anything else; every other operation needs a pinned token and the header. Refused to every credential with no person behind it (an organisation API key, a channel key, an embed session, a device).

Parameters#

ParameterType
requestOptions?RequestOptions

Returns#

Promise<{ id: string; logoUrl?: string; name: string; primaryColor?: string; secondaryColor?: string; slug: string; testMode: boolean; userId: string; }[]>

Operation Id#

getMyOrganisations

permissions()#

permissions: (options?: {
  action?: string;
  resource?: string;
}, requestOptions?: RequestOptions) => Promise<{
  filters: {
     action: string | null;
     resource: string | null;
  };
  isOrgAdmin: boolean;
  permissions: {
     accounts: string[];
     isAllAccounts: boolean;
     permission: string;
  }[];
}>;

Get my permissions Get the current user's effective permissions based on their role assignments. Supports filtering by resource and/or action.

Parameters#

ParameterType
options?{ action?: string; resource?: string; }
options.action?string
options.resource?string
requestOptions?RequestOptions

Returns#

Promise<{ filters: { action: string | null; resource: string | null; }; isOrgAdmin: boolean; permissions: { accounts: string[]; isAllAccounts: boolean; permission: string; }[]; }>

Operation Id#

getMyPermissions

redeemInvitation()#

redeemInvitation: (request: {
  invitation: string;
}, requestOptions?: RequestOptions) => Promise<{
  created: boolean;
  organisation: {
     id: string;
     name: string;
     slug: string;
  };
  userId: string;
}>;

Accept an invitation as the signed-in person Accept an invitation to an organisation as the person already signed in: the invitation must have been sent to their email address (403 INVITATION_EMAIL_MISMATCH otherwise, and it is left for that address to accept). They become a member with the roles it names, and it is spent: 409 INVITATION_ALREADY_REDEEMED a second time, 410 INVITATION_EXPIRED after its expiry. Takes the person's own access token from the Ticketlayer identity issuer, pinned to an organisation or not, and does not need X-Ticketlayer-Org. Then pin the session to the organisation it answers. Someone not signed in accepts through the issuer instead (POST /auth/invitations/start).

Parameters#

ParameterTypeDescription
request{ invitation: string; }-
request.invitationstringDescription The code from the invitation email (?code= in its link). Example inv_BvQ8mKx2...
requestOptions?RequestOptions-

Returns#

Promise<{ created: boolean; organisation: { id: string; name: string; slug: string; }; userId: string; }>

Operation Id#

redeemMyInvitation

revokeGrant()#

revokeGrant: (grantId: string, requestOptions?: RequestOptions) => Promise<boolean>;

Revoke one of my connected apps Revoke one of the signed-in person's grants at the identity issuer, with RFC 7009 semantics: its refresh tokens end with it, so the app cannot renew its access, and an access token already issued lapses within 15 minutes. 404 CONNECTED_APP_GRANT_NOT_FOUND for anything that is not one of the person's live grants to a third-party app. Takes the same token as GET /me/grants.

Parameters#

ParameterType
grantIdstring
requestOptions?RequestOptions

Returns#

Promise<boolean>

Operation Id#

revokeMyGrant

roles()#

roles: (requestOptions?: RequestOptions) => Promise<{
  isOrgAdmin: boolean;
  roles: {
     accountId: string;
     description: string | null;
     id: string;
     isSystemRole: boolean;
     name: string | null;
  }[];
}>;

Get my roles Get the current user's role assignments with role info (name, description). Does not include permissions - use /me/permissions for that.

Parameters#

ParameterType
requestOptions?RequestOptions

Returns#

Promise<{ isOrgAdmin: boolean; roles: { accountId: string; description: string | null; id: string; isSystemRole: boolean; name: string | null; }[]; }>

Operation Id#

getMyRoles