Login via Wallet

To authenticate via a wallet, follow these steps:

  1. 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.
  2. 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.
  3. 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.
  4. Sign the Message
    Use the wallet to sign the message provided by the getSignatureMessage mutation on one of the eligible Solana networks.
  5. 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.
  6. Save the Token
    Store the retrieved JWT token securely for use in subsequent API calls.

Summary of Steps

  1. Use the getSupportedNetworks query to retrieve the list of eligible Solana networks.
  2. Connect the Solana wallet from your application.
  3. Use the getSignatureMessage query to generate a signature message.
  4. Sign the provided message using the wallet.
  5. Call the loginWithSignature mutation to obtain the JWT access token.
  6. Save the token securely to use in further API interactions.