OAuth 2 Github service
Note: You are currently viewing documentation for Moodle 3.3. Up-to-date documentation for the latest stable version of Moodle is probably available here: OAuth 2 Github service.
Set up app in Github
- Enter to https://github.com/ go to settings> Developer settings> Oauth Apps> Register a new application.
- Include the application name, URL, description and callback URL like in the following image and click on Register Application.
- In the next screen your Client ID and Client Secret should appear.
Setup Moodle as a Client for Github
- Now in your Moodle you can access Site Administration>Servers>OAuth2>Create new custom service.
- Include the following information:
Name: Github Client ID: (the Client ID obtained previously) Client Secret: (the Client Secret obtained previously) Scopes included in a login request: read:user Scopes included in a login request for offline access: read:user Service base URL: https://api.github.com/ Logo URL: https://github.com/favicon.ico Show on login Page: checked
- Click on Save changes.
- Enter to Configure Endpoints in the Edit Menu of the service, there you must include the following information:
authorization_endpoint: https://github.com/login/oauth/authorize token_endpoint: https://github.com/login/oauth/access_token userinfo_endpoint: https://api.github.com/user
- Enter to configure user field mappings in the Edit menu of the service, there you must edit the following information:
the following mapping is presented as: External field name → Internal field name
name → firstname email → email login → username url → url avatar_url → picture location → city
- The last step would be to confirm that the OAuth2 authentication plugin is enabled in the authentication plugins management page.
- Additional note: if you configured a Github authentication service and any of your users is having problems to log in, its possible that they do not have any public e-mails. This setting can be changed by your users accessing to Github>Settings>Profile and there selecting an e-mail to be public.