Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: Unable to get current user session on functions using jwt #8174

Open
2 tasks done
Irutom opened this issue May 21, 2024 · 15 comments 路 May be fixed by #8313
Open
2 tasks done

馃悰 Bug Report: Unable to get current user session on functions using jwt #8174

Irutom opened this issue May 21, 2024 · 15 comments 路 May be fixed by #8313
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.

Comments

@Irutom
Copy link

Irutom commented May 21, 2024

馃憻 Reproduction steps

            import { Client} from 'node-appwrite';
            const userClient = new Client();
            const userAccount = new Account(userClient);

            userClient.setEndpoint(FUNCTIONS_END_POINT)
                .setProject(PROJECT_ID)
                .setJWT(x-appwrite-user-jwt);

            const currentSession = await userAccount.getSession('current');

馃憤 Expected behavior

getSession('current') should return the current user session that is being used.

馃憥 Actual Behavior

Fails with user_session_not_found error.

{"code":404,"type":"user_session_not_found","response":{"message":"The current user session could not be found."...}},

馃幉 Appwrite version

Appwrite Cloud

馃捇 Operating system

Linux

馃П Your Environment

1.5.5

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@Irutom Irutom added the bug Something isn't working label May 21, 2024
@stnguyen90 stnguyen90 added the product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services. label May 24, 2024
@stnguyen90
Copy link
Contributor

@Irutom, thanks for creating this issue! 馃檹 I talked with team and we want to make sure the get current session API returns the session matching the session id embedded in the JWT token.

@stnguyen90 stnguyen90 added the help wanted Extra attention is needed label May 24, 2024
@nickaldwin
Copy link

Hi @stnguyen90 I'm interested in working on this issue. Can I work on it?

@stnguyen90
Copy link
Contributor

@nickaldwin, assigned! Thanks for your interest! 馃檹馃徏

@nickaldwin
Copy link

nickaldwin commented Jun 6, 2024

@nickaldwin, assigned! Thanks for your interest! 馃檹馃徏

@stnguyen90 Thank you so much

@nickaldwin
Copy link

Hi @stnguyen90, Good morning and good evening! I hope you're doing great. This is my first time contributing to Appwrite. I'm having trouble replicating the issue on my end. I've followed the setup instructions and tried the reproduction steps, but I'm still facing difficulties.

Could you please provide more details on how to access and use the Appwrite Cloud function to replicate the issue?

@stnguyen90
Copy link
Contributor

@nickaldwin, have you looked through these docs?

That said, you don't even need to use an Appwrite function for this. You should be able to use a client SDK to

  1. Create an email password session
  2. Create a JWT token

Then, use a server SDK to set the JWT token and call Get session using "current" as the ID

@nickaldwin
Copy link

@nickaldwin, have you looked through these docs?

That said, you don't even need to use an Appwrite function for this. You should be able to use a client SDK to

  1. Create an email password session
  2. Create a JWT token

Then, use a server SDK to set the JWT token and call Get session using "current" as the ID

Hi @stnguyen90,

I will follow this. Thank you so much for providing the reference to replicate the issue.

@nickaldwin
Copy link

Hi @stnguyen90,

I hope you're well. I wanted to ask if there is a deadline for this issue. I apologize for not submitting a PR yet; this is my first time working with Appwrite, and I am still familiarizing myself with the codebase. I am very eager to work on this issue and would appreciate it if I could have some extra time to complete it. Thank you for understanding.

@stnguyen90
Copy link
Contributor

@nickaldwin, the sooner the better. Please keep us updated on your progress. Otherwise, I'll need to unassign you.

@nickaldwin
Copy link

nickaldwin commented Jun 18, 2024

Hi @stnguyen90

I will unassign myself from this issue due to upcoming commitments that will require my full attention. I apologize for any inconvenience this may cause and appreciate your understanding. It has been a pleasure contributing to Appwrite, and I look forward to contributing again in the future when my schedule allows.

@nickaldwin nickaldwin removed their assignment Jun 19, 2024
@Souptik2001
Copy link
Contributor

Hey @stnguyen90 , I can take this up.!

@stnguyen90
Copy link
Contributor

@Souptik2001, assigned! Thanks for your interest! 馃檹馃徏

@stnguyen90
Copy link
Contributor

Hi @stnguyen90

I will unassign myself from this issue due to upcoming commitments that will require my full attention. I apologize for any inconvenience this may cause and appreciate your understanding. It has been a pleasure contributing to Appwrite, and I look forward to contributing again in the future when my schedule allows.

No worries at all! Feel free to come back when you find the time 馃憢馃徏

@nickaldwin
Copy link

@stnguyen90 i will come back promise

@Souptik2001
Copy link
Contributor

Hi @stnguyen90 I have raised a PR for this one.

I have attached the detailed approach of the solution in the PR description itself. If you suggest some other approach please let me know. 馃憤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed product / auth Fixes and upgrades for the Appwrite Auth / Users / Teams services.
Projects
Status: In Progress
4 participants