question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redirected to /api/auth

See original GitHub issue

Hello!

I’m trying to use this package for my SvelteKit app. I’m using @sveltejs/kit 1.0.0-next.132.

I’ve copied your src/routes/api/auth/[...auth].ts and src/routes/login.svelte files. After clicking “Login with Google” I’m sent to through Googles flow but finally I just end up at /api/auth with a “Not found” message. If I go to /profile nothing is saved in the session.

Any suggestions on how to make this work? Cheers

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Odonnocommented, Sep 13, 2021

Ok, after reading the source code for 1 hour, I found the solution. You have to set the redirect property in the query params. So, for example:

<a href="/api/auth/signin/twitter?redirect=/" />
0reactions
megagames-mecommented, Aug 1, 2022

I am having this issue too, but I already set the redirect to /. I’m trying a very janky workaround by setting the redirect callback to the following:

redirect(url: string): string {
  return "/"
}

Furthermore, this problem only happens when I deploy to heroku. Even building locally and running doesn’t have this issue. I’m going to try the workaround and tell if it works.

Update: It works. I have no clue why, but at least it works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.Net Core - no redirect on API auth error - Stack Overflow
When authorization for accessing the action FetchAll() Fails I want HttpStatusCode.Forbidden as response. Instead Mvc does a reroute to Account/Login?ReturnUrl ...
Read more >
OAuth SCP login redirecting to Client page - osTicket Forum
My App registration in Azure has a redirect URI of https://helpdesk.domain/api/auth/oauth2. My Oauth instance matches the Azure settings as ...
Read more >
Authenticating and authorizing through a redirect URL - IBM
If you use methods for authentication that are not supported by API Connect, you can redirect users to a suitable URL at which...
Read more >
Microsoft OAuth2 - Redirect URI (reply URL) problem
Does it require that osTicket service need to be public as "Callback Endpoint" "http://helpdesk.mydomain.com/api/auth/oauth2" can be ...
Read more >
After being redirected from AUTH0_DOMAIN/authorize to ...
After being redirected from AUTH0_DOMAIN/authorize to callback I get token but ... https://auth0.com/docs/api-auth/grant/authorization-code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found