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

2024/03/30 20:32:51 could not find a matching session for this request exit status 1 #72

Open
sameer-gits opened this issue Mar 30, 2024 · 1 comment

Comments

@sameer-gits
Copy link

Hello i think my code is ok but it throws err

2024/03/30 20:32:51 could not find a matching session for this request
exit status 1

my repo link

main.go
https://github.com/sameer-gits/go-fiber/blob/main/main.go

routes.go
https://github.com/sameer-gits/go-fiber/blob/main/routes/routes.go

image

@SeriousBug
Copy link

SeriousBug commented Oct 13, 2024

The issue is KeyLookup: "header:session_name",. This tells goth_fiber that you want it to look up the current session via a header, BUT crucially this applies to the callback too. So if you set KeyLookup to header, and you point the OAuth callback to a function that calls goth_fiber.CompleteUserAuth, that will throw this error.

The solution? You can either:

  • Change key lookup to use a cookie, like KeyLookup: cookie:session_name
  • Or, don't make the callback handler run CompleteUserAuth. Make an API endpoint that calls CompleteUserAuth that is separate from the OAuth callback. When the user comes to the OAuth callback page, you'll use JavaScript to call the endpoint with the correct header set.

I switched to just using a cookie and that works fine.

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

No branches or pull requests

2 participants