#[SOLVED] Unauthorized Scope

46 messages · Page 1 of 1 (latest)

lavish horizon
#

I am getting this error but I am not able to fine where is might be. Can anyone help me read this error?

    at Client.call (C:\Users\canno\Desktop\Work\Clients\Phelps-Fitness\phelps-fit-2\node_modules\node-appwrite\lib\client.js:172:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Account.createVerification (C:\Users\canno\Desktop\Work\Clients\Phelps-Fitness\phelps-fit-2\node_modules\node-appwrite\lib\services\account.js:507:16) {
  code: 401,
  type: 'general_unauthorized_scope',
  response: {
    message: '[email protected] (role: applications) missing scope (account)',
    code: 401,
    type: 'general_unauthorized_scope',
    version: '1.3.7'```
#

The error is happening here. How do I fix it?

            .then(async (result) => {
                const promise = account.createVerification(
                    "http://localhost/verified"
                ).catch((error) => {
          console.log(error);
        });```
#

Nvm I think its becuase Im on account api and not user and not using jwt

#

Do I need to send the createVerification from client side if I dont want to mess with jwt

grizzled schooner
#

The user must be logged in before running createVerification

#

So if you want to run it from server side inside a function

#

Then, you must have the user JWT

#

And this is not available in the function.
As you're creating the user in the function.

lavish horizon
#

so they verify after they have logged in

grizzled schooner
#

Yes

#

You'll be able to run createVerification either with Client side account SDK after you run account.get()

Or with server side SDK with another function which has the user JWT

lavish horizon
#

Ahh I misunderstood then

#

I thought you had to verify before login

grizzled schooner
#

No

#

This is just an extra layer of security

#

If you want so

lavish horizon
#

Ty!

lavish horizon
#

I got it changed like it needs to be but I am getting this message in logs [critical] (Job{v1-mails} | ID: b687425c04d9d9813df7d8471e6e4cea | MailsV1

grizzled schooner
#

Is this a self-hosted?
Or Appwrite cloud?

lavish horizon
#

self

#
appwrite-worker-mails  | Stack trace:
appwrite-worker-mails  | #0 /usr/src/code/src/Appwrite/Resque/Worker.php(122): MailsV1->run()
appwrite-worker-mails  | #1 /usr/src/code/vendor/resque/php-resque/lib/Resque/Job.php(201): Appwrite\Resque\Worker->perform()
appwrite-worker-mails  | #2 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(303): Resque_Job->perform()
appwrite-worker-mails  | #3 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(242): Resque_Worker->perform(Object(Resque_Job))
appwrite-worker-mails  | #4 /usr/src/code/vendor/resque/php-resque/bin/resque(185): Resque_Worker->work('1', false)
appwrite-worker-mails  | #5 {main}```
#

I am not sure why that would be as a i have set up the email one outlook and it works fine

#

I just changed from tls to ssl to see if that fixes it

grizzled schooner
#

Have you set your SMTP settings in the .env file?

lavish horizon
#

yes

#

and I have checked that when I ran docker compse up -d it changed the .env files and it did

grizzled schooner
#

Okay, that souns like it should work

#
      - _APP_SMTP_HOST
      - _APP_SMTP_PORT
      - _APP_SMTP_SECURE
      - _APP_SMTP_USERNAME
      - _APP_SMTP_PASSWORD

What you put in host port and secure?

lavish horizon
#

appwrite is running localy does that do anything

grizzled schooner
#

No,

#

But who is your email provider?

lavish horizon
#

Me. Its on my server

#

it works though outlook

grizzled schooner
#

Mmm
I'm not sure about that one,
But who is the one who sends the email eventually?

#

You must have some provider,
Like you don't have any server for sending the emails?

lavish horizon
#

I have a server that has a 2 vms on it one running appwrite the other running plesk on 2 diffrent IP address. Plesk is host the website and the email

grizzled schooner
#

Gotcha

#

And this is the user name and the password you've set in your plesk?
Maybe you can try without @phelps.fit
Like so

_APP_SMTP_USERNAME=noreply
_APP_SMTP_PASSWORD=password
lavish horizon
#

ill try

#

GOT IT!

#

Wrong port like and idiot

#

Thank you @grizzled schooner for your help!

#

[SOLVED] Unauthorized Scope

#

Is there a way to customize the email

grizzled schooner
#

Not for now,
This is a popular requested feature.