mega.authenticate()
Last updated
Request an auth JWT from MOSS so your app can verify account identity without implementing a direct SIWE prompt flow. The user sees a single MOSS-led auth prompt; the resulting JWT goes to your backend for verification.
Use this when you want login/identity and want MOSS to own the challenge UX — your backend just verifies a JWT. If instead you need a raw signature over your own message (EIP-191, custom nonce, attestation), use signMessage() and verify it yourself with Server Verify. For full integration patterns, see MOSS Authentication.
mega.authenticate(): Promise<AuthenticateResponse>
None.
const auth = await mega.authenticate();
if (auth.status === 'success' && auth.jwt) {
await fetch('/api/auth/moss', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ jwt: auth.jwt }),
});
}success + jwt
Send to backend verification / session exchange.
cancelled
User dismissed the prompt. Show neutral retry UX.
error
Operational failure. Log + show retry guidance. Keep app state intact.
Don't trust client-only auth state. Validate the JWT server-side before issuing app sessions or granting access.
Last updated
type AuthenticateResponse = {
status: 'success' | 'cancelled' | 'error';
error?: string;
jwt?: string;
};