Anonymous login

Anonymous sessions allow you to implement guest users. Guest users let you store user information like items in their cart or theme preferences before they create an account. This reduces the friction for your users to get started with your app.

If a user later creates an account, their information will be inherited by the newly created account.

Create anonymous session

Create an anonymous session with Create Anonymous Session route.

import { Client, Account } from "appwrite";

const client = new Client()
    .setEndpoint('') // Your API Endpoint
    .setProject('<PROJECT_ID>');                 // Your project ID

const account = new Account(client);

const promise = account.createAnonymousSession();

promise.then(function (response) {
    console.log(response); // Success
}, function (error) {
    console.log(error); // Failure

Attaching an account

Anonymous users cannot sign back in. If the session expires, they move to another computer, or they clear their browser data, they won't be able to log in again. Remember to prompt the user to create an account to not lose their data.

Create an account with any of these methods to transition from an anonymous session to a user account session.

Email and password

Phone (SMS)

Magic URL