We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Implementation of Phosphorum does not login with github

Hi there,

I try to implement phosphorum to a new site and the forum works, the installation works fine and site goes live. But I have a problem with github authentication.

I did register the application and get the ClientID and Client Secret Application URL set on github like this:

https://forum.bitseros.com/

other field is the Authorization callback URL and set to this: https://forum.bitseros.com/oauth/github/access_token

The config set into .env file was with the same values appears on github

GITHUB_CLIENT_ID=1d3.....
GITHUB_SECRET=86d....
GITHUB_REDIRECT_URI=https://forum.bitseros.com/oauth/github/access_token

The problem it is when a click the "Login with GitHub" button and i got a 404 error

404 Sorry! We can't seem to find the page you're looking for. Error [-1]: Page not found File: /var/www/forum/app/controller/ErrorController.php Line: 84

The url shows some type of message:

https://forum.bitseros.com/oauth/github/access_token?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdeveloper.github.com%2Fv3%2Foauth%2F%23redirect-uri-mismatch&state=c2RpMnFMbnZNWTJXNjltcEY1MmJ4Zz09

Any idea what is wrong?

Thank you all.

edited Jan '17

Hi, according to the error you put different redirect_url and registred callback.

From the github's doc:

"Redirect URLs

The redirect_uri parameter is optional. If left out, GitHub will redirect users to the callback URL configured in the OAuth Application settings. If provided, the redirect URL's host and port must exactly match the callback URL. The redirect URL's path must reference a subdirectory of the callback URL.

CALLBACK: https://example.com/path

GOOD: https://example.com/path

GOOD: https://example.com/path/subdir/other

BAD: https://example.com/bar

BAD: https://example.com/

BAD: https://example.com:8080/path

BAD: https://oauth.example.com:8080/path

BAD: https://example.org"

Maybe try to set redirect_url as blank, it's only optional param