Beta

Frontend JS SDK

Complete references for Frontend API JavaScript SDK

Quickstart

Visit Frontend JS SDK's quickstart page.

Initialize SDK

import { CakeAuth } from "@cakeauth/frontend";
 
const cakeauth = new CakeAuth({
  publicKey: "pub_test_xxx",
});
 
// Sample usage
const res = await cakeauth.settings.list();

The publicKey value is your unique key that identifies your environment. Don't know where to get that? Check out this quick cheat sheet.


References

Current User (Me)

me.getInfo()

Get current user informations.

API: GET /v1/me

me.resetPassword()

Reset current session password (only available if current active identifier is_password_enabled=true).

API: POST /v1/me/reset_password


Reset Password

resetPassword.createPasswordResetAttempt()

Create a create password request attempt in an unauthorized settings.

API: POST /v1/reset_password/attempts

resetPassword.verifyPasswordResetAttempt()

Verify a password reset attempts

API: POST /v1/reset_password/attempts/:attempt_id/verify


Sessions

sessions.exchangeHandshakeId()

Exchange a handshake token with session. Used primarily in the OAuth process.

API: POST /v1/sessions/handshake/:handshake_token

sessions.listSessions()

List current user's active sessions.

API: GET /v1/sessions

sessions.getDetails()

Get current session details.

API: GET /v1/sessions/details

sessions.refreshAccessToken()

Refresh current session access token.

API: POST /v1/sessions/tokens

sessions.revokeSession()

Revoke current session (signout).

API: POST /v1/sessions/revoke


Environment Settings

settings.list()

List current environment settings/configurations.

API: GET /v1/settings


Signin

signin.getAvailableSigninStrategies()

Get available signin strategies for a provide-value.

API: POST /v1/signin/strategies

signin.createSigninAttempt()

Create a new signin attempts.

API: POST /v1/signin/attempts

signin.verifySigninAttempt()

Verify a signin attempt.

API: POST /v1/signin/attempts/:attempt_id/verify


Signup

signup.createSignupAttempt()

Create a new signup attempts.

API: POST /v1/signup/attempts

signup.verifySignupAttempt()

Verify a signup attempt.

API: POST /v1/signup/attempts/:attempt_id/verify

Last updated on