Skip to content
Back

[SOLVED] createverification not working

  • 0
  • Auth
  • Web
  • Cloud
KINGKabir👑
16 Jan, 2025, 20:29

getting the following response //verification response { "message": "User (role: guests) missing scope (account)", "code": 401, "type": "general_unauthorized_scope", "version": "1.6.1" } when trying account.createverification commenting out createverification funtion,everything works fine

TL;DR
Problem: User was facing issues with the `createVerification` function which was resulting in an error message. Solution: The user needs to first create an account, then establish a session with `createEmailPasswordSession`, and once the session is set, they can proceed with calling `createVerification`. This process will resolve the error message they were encountering.
KINGKabir👑
16 Jan, 2025, 20:31

verify-email/page.tsx

Kenny
16 Jan, 2025, 20:31

I believe after creating the account you need to create a session, once that session is established you can send verification.

Kenny
16 Jan, 2025, 20:32

So right now, the issue is that there is no session set in the instance. So it is effectively a "guest"

KINGKabir👑
16 Jan, 2025, 20:32

how can i wait for the session

Kenny
16 Jan, 2025, 20:33

wym?

Kenny
16 Jan, 2025, 20:34

I guess what I would do would be do something like this

  1. Create Account
  2. Create Session based on credentials passed to create account

This will navigate you to a session success route. You can then call the create verification function. Or you can set a banned at the top of the page saying your email hasn't been verified, click here to verify.

KINGKabir👑
16 Jan, 2025, 20:35

thank you ,trying it out, u save my whole week :appwriteheart:

Kenny
16 Jan, 2025, 20:40

Oh, actually, I'm seeing here createEmailPasswordSession does not have a redirect so you could do

TypeScript
const email = "email@email.com"
const password = "Password1!"
const username = "Kenny"

await account.create(
    ID.unique(),
    email,
    password,
    username
);

await account.createEmailPasswordSession(
    email,
    password
);

await account.createVerification(
    'https://locahost:3000/verify-email'
);
KINGKabir👑
16 Jan, 2025, 20:43

added a createEmailPasswordSession as u instructed boss, now its working!:appwriteheart: tysm

Kenny
16 Jan, 2025, 20:43

Sweet! Glad you got that figured out.

Kenny
16 Jan, 2025, 20:44

[SOLVED] createverification not working

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