JWT Authentication Flow
Wallet Login-Based Integration
Mojito Loyalty supports a wallet login-based integration, enabling users to securely access their accounts using their cryptocurrency wallets. This approach ensures seamless authentication and account management.
✨ Key Features
Secure Authentication: Users log in with their wallets, eliminating the need for passwords.
User Ownership: Ensures account access is tied directly to the user's wallet.
Simplified Onboarding: Requires no additional signup process for wallet users.
🔧 Integration Steps
- Set Up Wallet Login Flow
Integrate the Loyalty wallet authentication API into your application:- Present users with the option to log in via their wallet
- Use supported wallet connectors (e.g., SUI wallet, ZKLogin)
- Generate a unique nonce for the user during the login attempt
- Authentication Process
- Generate a Nonce request from the Signature API
- Sign the Nonce
Prompt the user to sign the provided nonce using their wallet - Verify the Signature
Send the signed nonce to the Loyalty API for verification
- Access Secured Endpoints
Use the bearer token received from the login API to authenticate requests to secured endpoints. Include the token in the authorization header.
curl -X POST https://sui-loyalty-api.mojito.xyz \
-H "authorization: Bearer JWT TOKEN" \
-H "Content-Type: application/json" \
Unique ID Login-Based Integration
Mojito supports a unique ID-based user login for easy integration. This approach uses the JWT issuer to validate users and allow them to be part of the system using existing integrations.
🔧 Integration Steps
- Set Up JWT issuer domain
Update the admin portal with your JWT issuer:- Log in to the admin portal and head to organization settings.
- Fill the JWT domain text-box with your JWT issuer.
- If you use a provider which doesn’t provide public JTWs please reach out to Mojito for integration support.
- A user's 'sub' will be considered as their unique ID.
- Access Secured Endpoints
Use the bearer token received from the JWT issuer to access our platform endpoints. Users will have accounts created for them based on their unique ID ('sub') from the bearer token and will then be allowed to access our API.
Updated about 2 months ago