To authenticate via a wallet, follow these steps:
- Establish a Wallet Connection
First, establish a valid wallet connection in your client-facing application. Ensure the application is connected to the appropriate network—either Solana Devnet or Solana Mainnet—based on your organization's configuration. - Fetch Supported Networks
Use the getSupportedNetworks query from the NETWORK API to retrieve a list of supported networks for your organization. For detailed information, refer to the getSupportedNetworks section. - Generate a Signature Message
After establishing the wallet connection, the next step is to generate a signature message using the getSignatureMessage query. This message will be used for authentication. - Sign the Message
Use the wallet to sign the message provided by the getSignatureMessage mutation on one of the eligible Solana networks. - Initiate Login with the Signature
Once the signature is approved by the wallet, initiate a GraphQL mutation, loginWithSignature, from the wallet callback to the Mojito backend. This will fetch the JWT token for the wallet connection. - Save the Token
Store the retrieved JWT token securely for use in subsequent API calls.
Summary of Steps
- Use the
getSupportedNetworks
query to retrieve the list of eligible Solana networks. - Connect the Solana wallet from your application.
- Use the
getSignatureMessage
query to generate a signature message. - Sign the provided message using the wallet.
- Call the
loginWithSignature
mutation to obtain the JWT access token. - Save the token securely to use in further API interactions.