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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token missing after initial redirect #15

Closed
fero1xd opened this issue Dec 10, 2024 · 2 comments · Fixed by #31
Closed

Token missing after initial redirect #15

fero1xd opened this issue Dec 10, 2024 · 2 comments · Fixed by #31

Comments

@fero1xd
Copy link
Contributor

fero1xd commented Dec 10, 2024

It seems that after being redirected from /callback to /, the access and refresh tokens are not present in the request. However, after the initial redirect, every subsequent request appears to include the tokens. I'm not very familiar with Astro, so this might be something specific to the framework. Here are some screenshots.

1
2
3

This results in user getting redirected back to the authorize page.

@adpadillar
Copy link
Contributor

adpadillar commented Dec 10, 2024

i got a similar problem in nextjs and i fixed it by using sameSite: "lax" instead of "strict" while setting the cookies.

export async function setTokens(access: string, refresh: string) {
  const c = await cookies();

  c.set("access_token", access, {
    httpOnly: true,
    sameSite: "lax", // strict breaks?
    path: "/",
    maxAge: 34560000,
  });

  c.set("refresh_token", refresh, {
    httpOnly: true,
    sameSite: "lax",
    path: "/",
    maxAge: 34560000,
  });
}

might be good to open a pr to update the astro example if people get confused by this? that's how i ended up with the same problem

related: vercel/next.js#17612

@ripley
Copy link

ripley commented Jan 3, 2025

might be good to open a pr to update the astro example if people get confused by this? that's how i ended up with the same problem

related: vercel/next.js#17612

Yeah not only astro, I ran into the same issue with the Lambda example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants