For the complete documentation index, see llms.txt. This page is also available as Markdown.

mega.authenticate()

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.

Signature

mega.authenticate(): Promise<AuthenticateResponse>

Parameters

None.

Example

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 }),
  });
}

Response

Status
Action

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.

Notes

Don't trust client-only auth state. Validate the JWT server-side before issuing app sessions or granting access.

Last updated