authenticate function initiates the full onboarding flow between your Mini App and the Lemon Cash app. It presents the user with your Mini App’s Terms & Conditions, Privacy Policy, and any claim or permission requests you specify. Once accepted, it authenticates the user using Sign In With Ethereum (SIWE) and returns the user’s wallet address, granted claims, and a signed message that verifies wallet ownership.
Important Guidelines
Your Mini App must follow these rules to be approved for publication.
- Call
authenticateas soon as the user enters your Mini App. It must be invoked before any other function (deposit,withdraw,callSmartContract, etc.). During this step, users are presented with the Terms & Conditions, Privacy Policy, and claim permissions. - Use
authenticateas your login flow. It is the only supported authentication method. If you need the user’s email or other data, request it as a claim viarequirements.claims. - Call
authenticateon every entry. Invoke it each time a user opens your Mini App to ensure the wallet address is always fresh. If your app supports multiple chains, re-triggerauthenticatewhen the user switches chains.
Usage
Parameters
If present, it must be at least 8 alphanumeric characters in length.
A unique nonce for the authentication request. This should be generated in your backend and be different for each authentication attempt.
The chain id to use for the authentication request. This parameter is required.
Optional requirements for the authentication request.
An array of claim keys that you want to request from the user. The available claim keys are defined in the
ClaimKey enum. See the Types documentation for the complete list of available claim keys.Returns
The result of the authentication attempt.
SUCCESS: The authentication was successful.FAILED: The authentication failed.CANCELLED: The authentication was cancelled by the user.
Contains the wallet address, granted claims, signature and message. Only present when the result is
SUCCESS.wallet: The wallet address of the authenticated user.grantedClaims: An array ofMiniAppGrantedClaimobjects containing the claims granted by the user. Each object has akey(theClaimKey) and avalue(the claim’s value). This will contain the claims that were requested in therequirements.claimsparameter, if provided.signature: The cryptographic signature proving the user’s authentication.message: The message that was signed by the user’s wallet.
Contains the error details when the authentication fails. Only present when the result is
FAILED.message: A human-readable error message describing what went wrong.code: A machine-readable error code for programmatic error handling.
Complete Authentication Flow
Backend endpoints The backend is responsible for generating a nonce and verifying the signature.ERC-6492 Support
The smart contract wallet is deployed on the first user’s transaction. Theauthenticate method supports ERC-6492 for contract wallets that are not yet deployed. This means users can authenticate even before their wallet contract is deployed.
Related Functions
deposit
Deposit funds to your Mini App Wallet.
Call Smart Contract
Interact with smart contracts on the blockchain.