Back

User (role: guests) missing scope (global)

  • 0
  • Flutter
  • Web
Darthbert
3 Sep, 2023, 00:28

Hello (again ;-))

I am trying to verify an user password with flutter. The user is created correctly and the email is sent to the correct account. When the user clicks on the link a 401 error User (role: guests) missing scope (global) general_unauthorized scope is shown The user has a valid session Any help is greatly appreciated

TL;DR
TL;DR: User is missing global scope while trying to verify password in Flutter app. They need to make sure the user has the correct scope assigned. Solution: Check the user's scope and make sure they have the necessary global scope for verification.
Drake
3 Sep, 2023, 00:37

verify user password? What do you mean?

and where are they being redirected to after clicking?

Drake
3 Sep, 2023, 01:36

that URL doesn't look right 🧐 it should contain the secret?

Darthbert
3 Sep, 2023, 01:46

It does. I think discord sanitizes the pasted link

Drake
3 Sep, 2023, 01:59

anyways....that's your app page? what's the code on that page?

Darthbert
3 Sep, 2023, 02:09
TypeScript
{
Future<bool> createUser(
      {required String email,
      required String password,
      required String name}) async {
    try {
      await _account.create(
          userId: ID.unique(), email: email, password: password, name: name);

      await _account.createEmailSession(email: email, password: password);
      
      await _account.createVerification(url: AppwriteConfig.verifyUrl);

      //await signInWithEmail(email: email, password: password);
      return Future.value(true);
    } catch (e) {
      currentUser.value = null;
      isAuthenticated.value = false;
      _errorHandler(e);
      return Future.value(false);
    }
  }
}
Darthbert
3 Sep, 2023, 02:13

Dumb question, is the verifyEmail Endpoint an appwrite default endpoint or do I have to code it?

Drake
3 Sep, 2023, 03:14

Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting

Drake
3 Sep, 2023, 03:16

You need to implement that. The url you pass into the create verification call should the url of your page where you can extract the secret from the url and then call the 2nd part of the verification flow

Darthbert
3 Sep, 2023, 03:19

Lol, I was afraid so after re-reading the docs. Can a function be used, or I literally have to implement a website to call the page from an android flutter app?

Drake
3 Sep, 2023, 03:23

You can also deep link

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