Back

what is this url?

  • 1
  • Auth
  • Web
vaulco
23 Aug, 2024, 06:05

what url does it mean in the docs of verification with email?

import { Client, Account } from "appwrite";

const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID

const account = new Account(client);

const result = await account.createVerification( 'https://example.com' // url );

console.log(response);

TL;DR
Developers are struggling with errors related to user authentication and server vs. client SDK usage in Appwrite. The solution involves properly setting session cookies, avoiding the use of API keys, and following the official documentation and a specific tutorial for guidance. Additionally, the JWT should be handled correctly and the 'createVerification' function should not be used with an API key.
faye
23 Aug, 2024, 11:51

(session?: string)

faye
23 Aug, 2024, 11:53

I recommend going with the setting a cookie route and use that cookie in each request, like this:

vaulco
23 Aug, 2024, 12:03

do you mean this? (the thing i replied too) or you still typing

faye
23 Aug, 2024, 12:04

Yes

faye
23 Aug, 2024, 12:07

You should first look over this. You are registering and logging in at the same time, and after logging in you are (again) redirecting to the login page. Makes no sense to do this, seems like an infinite loop.

If you wanna do it your way, you should keep watching Dennis's video. Seems like you stopped halfway as you made some weird path to what you are now with logging in/registering

vaulco
26 Aug, 2024, 23:07

hey @faye I checked the jwt secret that was created when logged in or in sign up, on jwt.io, it does not have any payload, it just has $id and secret in header

vaulco
27 Aug, 2024, 00:24

maybee im not retreving the session correctly?

faye
27 Aug, 2024, 00:38

register has no payload

faye
27 Aug, 2024, 00:38

afaik

vaulco
27 Aug, 2024, 00:53

and when i login too

vaulco
27 Aug, 2024, 00:56

how do we fix it? Is it my problem or is it appwrites. I watched the video fully, he does not do register, but login code is the same as his.

vaulco
27 Aug, 2024, 01:05

here is a decode token i got after logging in with his code { "id": "the id", "secret": "the secret" } no payload

ideclon
27 Aug, 2024, 07:39

How are you creating this JWT? And what are you using it for?

vaulco
27 Aug, 2024, 07:40

it creates a session with the logged in user, (name email, password)

ideclon
27 Aug, 2024, 07:44

I’m not really clear on what you’re trying to do here

ideclon
27 Aug, 2024, 07:45

If you’re just trying to do email verification, once you’ve signed in, just call the account.createVerification() method from the client side.

vaulco
27 Aug, 2024, 07:49

yep, thats the plan, but i get the error app.66bfddd300363a4e6bb0@service.cloud.appwrite.io (role: applications) missing scope (account) 401

vaulco
27 Aug, 2024, 07:50

when i add it

ideclon
27 Aug, 2024, 07:55

That means that you’re doing this from the Server SDK, not the Client SDK

ideclon
27 Aug, 2024, 07:56

Essentially, you’re not signed in as a user

vaulco
27 Aug, 2024, 07:57

but why does it still display the information of the user as if it was signed in, like the name when i haven't inputted it, but it was still retrieved, and redirected me to the protected page

vaulco
27 Aug, 2024, 07:59

what should I add, to avoid this error, and receive the email in my inbox to verify

ideclon
27 Aug, 2024, 08:00

Well, what are you displaying and how are you displaying it?

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