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

Github OAuth2 not working #46

Closed
superhize opened this issue Apr 26, 2023 · 6 comments
Closed

Github OAuth2 not working #46

superhize opened this issue Apr 26, 2023 · 6 comments

Comments

@superhize
Copy link

Hello,

I just finished setting up Pastefy, but for some reason, the github oauth2 do not work.

I've set the Callback URL to "http://server/api/v2/auth/oauth2/github/callback" and got this:

{
  "success": false,
  "exception": "NullPointerException",
  "error": true,
  "exists": false
}

OAUTH2_GITHUB_CLIENT_ID and OAUTH2_GITHUB_CLIENT_SECRET are both set in docker-compose.yml

and also got the follow error in docker logs: https://pastebin.com/hq0LLzWs

@superhize superhize changed the title Github OAuth not working2 Github OAuth2not working Apr 26, 2023
@superhize superhize changed the title Github OAuth2not working Github OAuth2 not working Apr 26, 2023
@JulianFun123
Copy link
Member

Did you set the SERVER_NAME environment variable as well?

@superhize
Copy link
Author

superhize commented Apr 26, 2023

SERVER_NAME is set to "http://localhost:9999", should i change that ? I'm using a nginx proxy.

EDIT: Changed SERVER_NAME TO https://paste.domaine/ but still the same error.

@JulianFun123
Copy link
Member

Hey I have tried your Website in your Github description and added the paste. prefix. When I try to log in, I get the error you sent. In the redirection URL the error is given https://paste.hize.be/api/v2/auth/oauth2/github/callback?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdocs.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23redirect-uri-mismatch.

error=redirect_uri_mismatch. You may have not set the SERVER_NAME correctly or didn't set it up correctly in your GitHub App settings

@superhize
Copy link
Author

Homepage url is set to https://paste.hize.be/
callback url is set tp https://paste.hize.be/api/v2/auth/oauth2/github/callback
SERVER_NAME is set to https://paste.hize.be/, even tried with localhost:9999, http://localhost:9999, but nothing work

@JulianFun123
Copy link
Member

You may want to remove the slash in the end of https://paste.hize.be. It seems to be not a problem with Pastefy itself.

@superhize
Copy link
Author

Indeed, removing the slash in the end fixed it, thanks!

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