Autenticación OAuth 2

De MoodleDocs

¡Nueva característica
en Moodle 3.3!

Nota: Pendiente de Traducir. ¡Anímese a traducir esta página!.     ( y otras páginas pendientes)

Login page with options to log in with an OAuth 2 service

Log in using your account on another site

The OAuth 2 authentication plugin enables users to log in using their Google, Microsoft and/or Facebook account via buttons on the login page.

If account creation is enabled, when a user first logs in, a new account will be created. Otherwise, they will be prompted to [[Ingresos Enlazados|enlazarlos a sus cuentas existentes] con las mismas direcciones Email.

Enabling OAuth 2 authentication

To use OAuth 2 authentication, an administrator must first create the required OAuth 2 services.

  1. Go to 'OAuth 2 services' in Site administration > Server and click the button to create a new service.
  2. Follow the instructions in Servicio OAuth 2 Google, Servicio OAuth 2 Microsoft or Servicio OAuth 2 Facebook and obtain a client ID and secret.
  3. Enter the client ID and secret, make sure 'Show on login page' is ticked, then save changes.

¡Nueva característica
en Moodle 3.4!
Si lo deseara, desactive la casilla para 'Requerir verificación de Email', y entonces no se enviará un email para confirmación. Esto es útil para institutciones que usan Google para su dominio; el provedor de Google OAuth puede considerarse confiable para ese dominio.

Repita como lo desee para servicios adicionales. Para autenticación OAuth 2, no hay necesidad de contectar a una cuenta del sistema.


  1. Go to 'Manage authentication' in Site administration and enable the OAuth 2 authentication plugin.
  2. Optional: In the OAuth 2 settings, lock selected user data fields and save changes.

Preventing new account creation

If you don't want new accounts to be created when users log in with an OAuth 2 service:

  1. Go to 'Manage authentication' in Site administration and tick the box 'Prevent account creation when authenticating' (authpreventaccountcreation).
  2. Click the 'Save changes' button.


On the 'OAuth 2 services' page, there is a red cross for 'Allow login'

To get a green tick for Allow login, edit the OAuth 2 service and make sure that the setting 'Show on login page' is ticked.

I obtain a coding error after enabling OAuth 2 authentication

Have you any OAuth 2 plugins for earlier versions installed on your site? If so, you will need to desinstalarlos in order to use the standard OAuth 2 authentication.

I obtain an error message when attempting to log in using Facebook

The error message 'The user information returned did not contain a username and email address. The OAuth 2 service may be configured incorrectly.' is most likely because the user's Facebook account was created using a mobile number.

The solution is for the user to first log in to Facebook and add a username and email address there.

I see a "required paramenter (code) was missing" error after logging into the OAuth 2 service

The error message 'A required parameter (code) was missing' 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 for one possible solution.