Back

Create Verification Errors

  • 0
  • Web
itsjustintime
26 Dec, 2023, 00:35

I'm unable to get a verification e-mail sent to the user on Appwrite Cloud. I've set the Platform Integrations in the root of my project to * in the dashboard while I'm testing locally.

I have this line here await account.createVerification(${window.location.origin}/verify/account); and it always fails after a user account is created. I want to send a verification e-mail, but I get this exception:

TypeScript
AppwriteException: User (role: guests) missing scope (account)
    at Client.<anonymous> (http://localhost:8100/static/js/bundle.js:164974:17)
    at Generator.next (<anonymous>)
    at fulfilled (http://localhost:8100/static/js/bundle.js:164608:24)

As far as I can tell in the Cloud dashboard, there's no where to change any guest access policy so I'm not sure how this exception is related.

Can someone provide me any direction? I just want to test the user registration flow to get a verification e-mail sent.

TL;DR
The user is trying to send a verification email to new users on their app, but they are encountering an error. The error message indicates that the user is missing the 'account' scope. The user has tried setting the 'Platform Integrations' to '*' in the dashboard but the issue persists. They are seeking guidance on how to resolve this and send verification emails successfully. Solution: The user needs to make sure the `await account.createEmailSession(email, password);` function is called before sending the verification email.
Drake
26 Dec, 2023, 00:37

What's your code? Role: guests means there's no session. Did you create a session before?

itsjustintime
26 Dec, 2023, 00:41

Got it working πŸ™‚ I had the session logic bundled as "log in" logic. So logically I wanted to send verification before logging in. But I guess that was the wrong way of thinking about it.

So solution is to make sure await account.createEmailSession(email, password); is called prior to sending verification.

itsjustintime
26 Dec, 2023, 00:44

hm, I'm looking into this now. But I can still log in (IE create a session) prior to verification so it seems like I might need client-side logic to handle non-verified users?

Drake
26 Dec, 2023, 00:45

I usually let people log in, but restrict access to resources to verified users.

Drake
26 Dec, 2023, 00:46

And then, client side, you can check if they are verified or not client side and tell them to verify

itsjustintime
26 Dec, 2023, 00:47

sounds good. I'll have to build those checks in and set up another page on verification.

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