Diferencia entre revisiones de «Autenticación OAuth 2»

De MoodleDocs
(tidy up)
(tidy up)
 
(No se muestran 8 ediciones intermedias del mismo usuario)
Línea 1: Línea 1:
{{Autenticación}}{{Nuevas características de Moodle 3.3}}
{{Autenticación}}{{Nuevas características de Moodle 3.3}}
{{Urgente de traducir}}
{{Pendiente de traducir}}


[[File:oauth 2 auth.png|thumb|Login page with options to log in with an OAuth 2 service]]
== Vista general==
==Log in using your account on another site==
OAuth 2.0 is the de facto industry standard protocol for user authorisation. OAuth 2 authentication enables users to access Moodle via buttons on the login page using their credentials from popular service providers, such as Google, Microsoft, Facebook, and LinkedIn.
[[File:OAuth Login.png|border|center|frameless|600x600px]]
The following high-level interaction process illustrates how OAuth 2 authentication works in a Moodle context:
[[File:OAuth - Service Provider Authentication.png|border|center|frameless|600x600px]]


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|link it to their existing account]] with the same email address.
An OAuth service provider is an external system (“in the cloud”) that provides identity (via the authorisation server) and API access (via the resource server) by issuing OAuth access tokens to a client (Moodle). Let’s go through the interactions from top to bottom:
# A user sends an authorisation request; that is, a user logs in to the service provider via the client. This step is initiated via the service provider buttons on the Moodle login screen.
# The authorisation server issues an authorisation code if the entered credentials are valid. Once this has taken place, the user is authenticated with Moodle. If account creation is enabled (the Prevent account creation when authenticating setting), a new account will be created. Otherwise, the user will be prompted to link the authorisation to an existing account with the same email address. An entry can be found in the [[Linked logins]] section in the user’s preferences.
# An access token will be issued when the user logs in using the stored authorisation code. A scheduled task exists to regularly update the OAuth 2 tokens (\core\oauth2\refresh_ system_tokens_task).
# Moodle uses this access token for any internal services that require a resource from the service provider, for instance, a link to files in a repository. Some internal services require a system account to be connected.


==Habilitar autenticación OAuth 2==
==Configurar una autenticación OAuth 2==
To use OAuth 2 authentication, an administrator must follow the following steps:
# Configure OAuth 2 services: Go to '''Site administration > Server > OAuth 2 services''', and following the instructions on the [[OAuth 2 services]] page.
# Enable OAuth 2: Go to '''Site administration > Plugins > Authentication''', enable '''OAuth 2'''.
# Configure OAuth 2 lock user fields: To control if and how certain user data fields are being populated, click on the '''Settings''' link and configure your '''Lock user fields'''.
# Prevent account creation: By default, account creation is enabled. If you wish to prevent account creation, go to '''Site administration > Plugins > Authentication''' and enable the setting "authpreventaccountcreation".
# Testing, testing, testing: To verify that your OAuth 2 configuration is working, go to '''Site administration > Plugins > Authentication''' and click on the '''Test settings''' link in the '''OAuth 2''' row. Here, you can select a service and test its connection.


To use OAuth 2 authentication, an administrator must first create the required OAuth 2 services.
The following Moodle features require an OAuth2 service:


# Go to 'OAuth 2 services' in Site administration > Server and click the button to create a new service.
* Repositories: [[Repositorio Dropbox]], [[Repositorio Google Drive]], Microsoft [[Repositorio OneDrive]], and [[Repositorio Nextcloud]]
# Follow the instructions in [[Servicio OAuth 2 Google]], [[Servicio OAuth 2 Microsoft]] or [[Servicio OAuth 2 Facebook]] and obtain a client ID and secret.
* Portfolios: [[Portafolio Google Drive]]
# Enter the client ID and secret, make sure 'Show on login page' is ticked, then save changes.
* Badges: [[Mochilas|Open Badges 2.1]]
* Mail: Incoming and outgoing [[Configuración del correo|configuración del correo]]
* Document converters: [[Convertidor Google Drive]]


Repeat for additional services as desired. For OAuth 2 authentication, there is no need to connect to a system account.
==Vea también==
* [https://docs.moodle.org/403/en/OAuth_2_Troubleshooting OAuth 2 troubleshooting]


Next:


# Go to 'Manage authentication' in Site administration and enable the OAuth 2 authentication plugin.
[[Categoría:OAuth 2]]
# Optional: In the OAuth 2 settings, lock selected user data fields and save changes.
 
==Impedir creación de cuenta nueva==
 
If you don't want new accounts to be created when users log in with an OAuth 2 service:
 
# Go to 'Manage authentication' in Site administration and tick the box 'Prevent account creation when authenticating' (authpreventaccountcreation).
# Click the 'Save changes' button.
 
==Troubleshooting==
 
===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 [[Installing plugins|uninstall them]] in order to use the standard OAuth 2 authentication.
[[Categoría:OAuth 2]]
[[en:OAuth 2 authentication]]
[[en:OAuth 2 authentication]]

Revisión actual - 17:44 9 feb 2024

¡Nueva característica
en Moodle 3.3!

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


Vista general

OAuth 2.0 is the de facto industry standard protocol for user authorisation. OAuth 2 authentication enables users to access Moodle via buttons on the login page using their credentials from popular service providers, such as Google, Microsoft, Facebook, and LinkedIn.

OAuth Login.png

The following high-level interaction process illustrates how OAuth 2 authentication works in a Moodle context:

OAuth - Service Provider Authentication.png


An OAuth service provider is an external system (“in the cloud”) that provides identity (via the authorisation server) and API access (via the resource server) by issuing OAuth access tokens to a client (Moodle). Let’s go through the interactions from top to bottom:

  1. A user sends an authorisation request; that is, a user logs in to the service provider via the client. This step is initiated via the service provider buttons on the Moodle login screen.
  2. The authorisation server issues an authorisation code if the entered credentials are valid. Once this has taken place, the user is authenticated with Moodle. If account creation is enabled (the Prevent account creation when authenticating setting), a new account will be created. Otherwise, the user will be prompted to link the authorisation to an existing account with the same email address. An entry can be found in the Linked logins section in the user’s preferences.
  3. An access token will be issued when the user logs in using the stored authorisation code. A scheduled task exists to regularly update the OAuth 2 tokens (\core\oauth2\refresh_ system_tokens_task).
  4. Moodle uses this access token for any internal services that require a resource from the service provider, for instance, a link to files in a repository. Some internal services require a system account to be connected.

Configurar una autenticación OAuth 2

To use OAuth 2 authentication, an administrator must follow the following steps:

  1. Configure OAuth 2 services: Go to Site administration > Server > OAuth 2 services, and following the instructions on the OAuth 2 services page.
  2. Enable OAuth 2: Go to Site administration > Plugins > Authentication, enable OAuth 2.
  3. Configure OAuth 2 lock user fields: To control if and how certain user data fields are being populated, click on the Settings link and configure your Lock user fields.
  4. Prevent account creation: By default, account creation is enabled. If you wish to prevent account creation, go to Site administration > Plugins > Authentication and enable the setting "authpreventaccountcreation".
  5. Testing, testing, testing: To verify that your OAuth 2 configuration is working, go to Site administration > Plugins > Authentication and click on the Test settings link in the OAuth 2 row. Here, you can select a service and test its connection.

The following Moodle features require an OAuth2 service:

Vea también