Back

createVerification

  • 1
  • React Native
  • Auth
Musti
10 Jul, 2024, 07:37

Hey,

I'm trying to verify the user once they create their account. I'm running an expo project.

I thought that user authentication would be easy but it's turning out to be a headache and I'd really appreciate some guidance.

My question is why, based on the code below, do I get the error
LOG [AppwriteException: User (role: guests) missing scope (account)]

code:

TypeScript
const client = new Client();

client
    .setEndpoint(config.endpoint) // Appwrite Endpoint
    .setProject(config.projectId) // project ID
    .setPlatform(config.platform) // application ID or bundle ID.
    ;


const account = new Account(client);

// signup
export const createUser = async (email, password) => {
    try {
        const newAccount = await account.create(ID.unique(), email, password);
        if (!newAccount) throw Error('Error creating user');
        // login the user
        Login(email, password);
        // Send verification email
        const verify = await account.createVerification('BookQuest://(auth)/verify');
        console.log(verify)


        return newAccount;
    } catch (error) {
        console.log(error);
        throw new Error(error);
    }
}

// signin
export const Login = async (email, password) => {
    try {
        const session = await account.createEmailPasswordSession(email, password);
        return session;
    } catch (error) {
        throw new Error(error)
    }
}

I also need help understanding how the whole verification process should work with an expo app.

Thanks in advance

TL;DR
Developer needs help verifying users upon account creation in an Expo project. They are encountering the error `AppwriteException: User (role: guests) missing scope (account)`. The issue might be related to missing account scope. Possible Solution: It seems the `createVerification` method requires the account scope, which the current 'guests' role might lack. Consider assigning the necessary scope to the role.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more