<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/37/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wnymathguy</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/37/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Wnymathguy"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/37/en/Special:Contributions/Wnymathguy"/>
	<updated>2026-04-11T02:05:51Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/37/en/index.php?title=OAuth_2_authentication&amp;diff=130182</id>
		<title>OAuth 2 authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/37/en/index.php?title=OAuth_2_authentication&amp;diff=130182"/>
		<updated>2018-02-25T03:56:35Z</updated>

		<summary type="html">&lt;p&gt;Wnymathguy: /* Troubleshooting */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
[[File:oauth 2 auth.png|thumb|Login page with options to log in with an OAuth 2 service]]&lt;br /&gt;
==Log in using your account on another site==&lt;br /&gt;
&lt;br /&gt;
The OAuth 2 authentication plugin enables users to log in using their Google, Microsoft and/or Facebook account via buttons on the login page.&lt;br /&gt;
&lt;br /&gt;
If account creation is enabled, when a user first logs in, a new account will be created. Otherwise, they will be prompted to [[Linked logins|link it to their existing account]] with the same email address.&lt;br /&gt;
&lt;br /&gt;
==Enabling OAuth 2 authentication==&lt;br /&gt;
&lt;br /&gt;
To use OAuth 2 authentication, an administrator must first create the required OAuth 2 services.&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;OAuth 2 services&#039; in Site administration &amp;gt; Server and click the button to create a new service.&lt;br /&gt;
# Follow the instructions in [[OAuth 2 Google service]], [[OAuth 2 Microsoft service]] or [[OAuth 2 Facebook service]] and obtain a client ID and secret.&lt;br /&gt;
# Enter the client ID and secret, make sure &#039;Show on login page&#039; is ticked, then save changes.&lt;br /&gt;
&lt;br /&gt;
{{New features}}If desired, un-tick the &#039;Require email verification&#039; box, then a confirmation email is not sent. This is useful for institutions using Google for their domain; the Google OAuth provider can be considered trusted for that domain. &lt;br /&gt;
&lt;br /&gt;
Repeat for additional services as desired. For OAuth 2 authentication, there is no need to connect to a system account.&lt;br /&gt;
&lt;br /&gt;
Next:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;Manage authentication&#039; in Site administration and enable the OAuth 2 authentication plugin.&lt;br /&gt;
# Optional: In the OAuth 2 settings, lock selected user data fields and save changes.&lt;br /&gt;
&lt;br /&gt;
==Preventing new account creation==&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want new accounts to be created when users log in with an OAuth 2 service:&lt;br /&gt;
&lt;br /&gt;
# Go to &#039;Manage authentication&#039; in Site administration and tick the box &#039;Prevent account creation when authenticating&#039; (authpreventaccountcreation).&lt;br /&gt;
# Click the &#039;Save changes&#039; button.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
&lt;br /&gt;
===On the &#039;OAuth 2 services&#039; page, there is a red cross for &#039;Allow login&#039;===&lt;br /&gt;
&lt;br /&gt;
To get a green tick for Allow login, edit the OAuth 2 service and make sure that the setting &#039;Show on login page&#039; is ticked. &lt;br /&gt;
&lt;br /&gt;
===I obtain a coding error after enabling OAuth 2 authentication===&lt;br /&gt;
&lt;br /&gt;
Have you any OAuth 2 plugins for earlier versions installed on your site? If so, you will need to [[Installing plugins|uninstall them]] in order to use the standard OAuth 2 authentication.&lt;br /&gt;
&lt;br /&gt;
===I obtain an error message when attempting to log in using Facebook===&lt;br /&gt;
&lt;br /&gt;
The error message &#039;The user information returned did not contain a username and email address. The OAuth 2 service may be configured incorrectly.&#039; is most likely because the user&#039;s Facebook account was created using a mobile number.&lt;br /&gt;
&lt;br /&gt;
The solution is for the user to first log in to Facebook and add a username and email address there.&lt;br /&gt;
&lt;br /&gt;
=== I see a &amp;quot;required paramenter (code) was missing&amp;quot; error after logging into the OAuth 2 service ===&lt;br /&gt;
&lt;br /&gt;
The error message &#039;A required parameter (code) was missing&#039; can be caused by a mis-configured webserver. OAuth 2 relies on long tokens passed as url parameters, and some webserver configurations will prevent this from working. See http://www.php.net/manual/en/reserved.variables.get.php#101469 for one possible solution.&lt;br /&gt;
&lt;br /&gt;
=== I have all green checkmarks on my /admin/tool/oauth2/issuers.php page for Google &amp;amp; Facebook but no buttons show on my servers login page ===&lt;br /&gt;
&lt;br /&gt;
It was discovered that in a fresh install of Moodle 3.4 (probably for security reasons) that the plugin configuration for OAuth2 was in a disabled state. Go to your page for Site Administration - Plugins - Authentication - Manage authentication (/admin/settings.php?section=manageauths), and enable the record for OAuth2, then optionally tweak your settings for that record.&lt;br /&gt;
&lt;br /&gt;
[[Category:OAuth 2]]&lt;br /&gt;
&lt;br /&gt;
[[es:Autenticación OAuth 2]]&lt;br /&gt;
[[de:OAuth2 Authentifizierung]]&lt;/div&gt;</summary>
		<author><name>Wnymathguy</name></author>
	</entry>
</feed>