Tray Embedded / Building Integrations / User Management

User Management

Read first

Make sure you have read the following sections before proceeding:

Introduction

An External User of your Embedded application is somebody who has Instances of your Solutions set up and configured for their own use.

Your users should be stored in your own user database, and when they are created using the createExternalUser API they will be stored in your Tray Embedded account.

They must be linked between these two databases using a common externalUserId, which is created in your database and then passed as a parameter when using the createExternalUser API.

Key data

  • id is the unique ID of the user which is returned when creating a new user
  • externalUserId is a unique id taken from your external user database, used to link them in the Tray Embedded database
  • accessToken is a user token which allows access to the APIs which require a user token. It should be stored securely in your application and expires after 2 days
  • authorizationCode is a one-time access code which allows a user to access the Configuration Wizard and configure a Solution Instance for their own use

See our API reference docs for more complete information on data associated with End Users.

Viewing End Users in Tray.io

In the Tray Embedded UI it is possible to view End Users and their activated Instances.

APIs involved

  • The GraphQL createExternalUser mutation is used to create a new External User. This will return a userId
  • The authorize mutation is used to create an access token for an External User, which is passed as a Bearer with user-specific APIs such as Create Solution Instance, Get Solution Instances and Create User Authentication. This token should be stored in your application expires after 2 days
  • The generateAuthorizationCode mutation is used to generate a one-time access code for the Config Wizard

Considerations when choosing ‘End-user’ information

externalUserId

It is recommended that the externalUserId for each customer is set to match the internal id for them in your external database, to enable mapping between the two systems.

If you wish to associate an End User with a group (i.e. company / department) then the externalUserId can be linked to the internal id for that group in your database.

Connected topics

The next page in this section will take you through displaying Solutions for your End Users: