Before you can begin using Passport, you must install the XpansionChain SDK and initialise the Passport Client. The SDK Passport Module enables games & third-party applications to leverage XpansionChain authentication and wallet functionalities.
Next, we'll need to initialise the Passport client. The Passport constructor accepts a PassportModuleConfiguration object, which has the following interface:
An instance of an XpansionChainConfiguration, which defines shared configuration across all the XpansionChain modules, such as the environment. This can be initialised as follows:
INFO
Note: The environment argument can be one of the following:
Environment Configuration
Description
Environment.SANDBOX
The default test network (currently, it is Goërli)
The URI of your application that users will be redirected to after successfully authenticating. This value must match one of the Callback URLs that have been set against your client in the XpansionChain Developer Hub
The URI of your application that users will be redirected to after successfully logging out. This value must match one of the Logour URL's that have been set against your client in the XpansionChainDeveloper Hub
A string containing the audience(s) that the issued token is intended for, with each audience being separated by a space. Passport currently supports the following audiences:
platform_api: The identifier for the XpansionChain protocol APIs
INFO
Note: The platform_api audience is required in order to interact with the XpansionChain protocol.
A string containing the scope(s) that specify what access privileges are being requested, with each scope being separated by a space. The following custom scopes are supported:
transact: Allows the authenticating application to interact with the users Passport wallet.
In addition to the above, the following standard OIDC scopes are strongly recommended:
openid: Informs the Authorization Server that the client is making an OpenID connect request.
offline_access: Requests that an OAuth 2.0 Refresh Token be issued. The Refresh Token is used by Passport during registration to initialise the user's wallet.
email: Requests that the client gains access to the users email address.
INFO
Note: The transact, openid & offline_access scopes are all currently required to correctly interact with Passport.