I'm trying to use Github as a Oauth2 service provider for login authentication in my moodle 3.3, for this, I set up a new custom service in "Oauth 2 Services" configuration:
- Name: Github
- Client ID and secret correctly configured.
- Scopes (tried): user and user:emai
- Additional parameters: none
- Service base: URL: https://api.github.com/
- Login Domains: (empty)
- Logo URL: https://github.com/favicon.ico
- "Show on login page" marked.
The endpoints configured are:
- authorization_endpoint: https://github.com/login/oauth/authorize
- token_endpoint: https://github.com/login/oauth/access_token
- userinfo_endpoint: https://api.github.com/user
In my Github settings :
- Authorization Callback URL: https://<my moodle site>/admin/oauth2callback.php
- And the other settings are irrelevant (like name, description, home page, ...)
When I try to login in my site, it redirects to Github correctly, after I enter credentials, Github requires me authorization for the moodle site as usual in oauth2 mecanism. But immediately i click in Authorize button, Github redirects me to the correct Callback URL with a code, but my moodle responds with a 303 HTTP code and repeats a redirection to Github and so on, until Github claims too many tries, making authorization impossible.
I don't know if is a configuration error or a bug in moodle. please advice. Would really appreciate it. Network redirections file attached for reference.
Thank You.