Back

(role: applications) missing scope (account) (401) createVerification

  • 0
  • Flutter
  • Accounts
Paka
17 Apr, 2023, 21:11

When attempting to create a verification, I get the following exception: AppwriteException: general_unauthorized_scope, app.wordmap@service.cloud.appwrite.io (role: applications) missing scope (account) (401)

Implementation is as:

TypeScript
client.account.create(
                    userId: userId.value!,
                    email: email.value!,
                    password: password.value!,
                  );

                  final token = await server.account.createVerification(
                    url: 'https://cloud.appwrite.io/v1/wordmap',
                  );
                  print(token.secret);

The server client, I have initialised as:

TypeScript
final client = Client()
    .setEndpoint('https://cloud.appwrite.io/v1')
    .setProject('wordmap')
    .setSelfSigned(status: true)
    .setKey(
      'MY_KEY',
    );
TL;DR
The user is experiencing a "missing scope" error when trying to create a verification for an account using the Appwrite Dart client. They are unsure of what to put for the URL parameter and whether they should be using the Dart or Flutter client. Another user suggests that they need to create a session before calling `account.createVerification()`. The user also asks if the `https://cloud.appwrite.io/v1/wordmap` URL is their project ID. The user includes their implementation code and the error they are receiving. Solution: To resolve the missing scope error, the user needs to add the `account` scope to their role
Binyamin
17 Apr, 2023, 21:14

Is wordmap your project ID?

Paka
17 Apr, 2023, 21:14

It is indeed @Binyamin

Binyamin
17 Apr, 2023, 21:15

Cool

Binyamin
17 Apr, 2023, 21:16

In the first function What is this url? https://cloud.appwrite.io/v1/wordmap ?

Paka
17 Apr, 2023, 21:16

Should I even be using the dart client for creating a verification though? (confused with the whole flutter/dart client thing)

Paka
17 Apr, 2023, 21:17

That was my stab in the dark - I have no idea what I should be putting for the URL, check docs, was a tad abstract regarding the url.

Binyamin
17 Apr, 2023, 21:17

What is you're trying to achieve? And yes you can send it from the flutter/dart

Paka
17 Apr, 2023, 21:18

So then either way, using the flutter or dart client - I still get permission/scope errors.

I'm just wanting to create an account and verify it.

Binyamin
17 Apr, 2023, 21:18

In flutter (All mobile) I think it mean that you'll have to create deep link logic

Binyamin
17 Apr, 2023, 21:18
Drake
17 Apr, 2023, 21:19

you're getting that error because you need a session to call account.createVerification()

Drake
17 Apr, 2023, 21:19

createVerification

Paka
17 Apr, 2023, 21:19

Alright, I'll try creating a session. See how that goes

Drake
17 Apr, 2023, 21:19

(role: applications) missing scope (account) (401) createVerification

Paka
17 Apr, 2023, 21:25

@Steven do I pass the appwrite cloud api endpoint as the URL?

TypeScript
late am.Session session;
                if (userId.value != null &&
                    email.value != null &&
                    password.value != null) {
                  final account = await client.account.create(
                    userId: userId.value!,
                    email: email.value!,
                    password: password.value!,
                  );

                  session = await client.account.createEmailSession(
                    email: email.value!,
                    password: password.value!,
                  );

                  final token = client.account.createVerification(
                    url: 'https://cloud.appwrite.io/v1',
                  );
Drake
17 Apr, 2023, 21:26
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