Google OAuth 2.0 setup: Difference between revisions

From MoodleDocs
(links, rewording)
No edit summary
 
(31 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Repositories}}
{{Repositories}}
''Note: This page contains information for site administrators.''
''Note: This page contains information for site administrators only.''


==OAuth 2.0==
==Registering with Google==
 
Each Moodle site  needs to be registered with Google i.e. have a Google Developers Console project in order to use the Google Drive, Docs or Picasa plugins. As part of the registration process, you will need to enter an authorized redirect URI (something like <nowiki>http://yourmoodlesite.org/admin/oauth2callback.php</nowiki>) which is provided on all Google Drive, Docs and Picasa plugins configuration pages in Moodle, such as ''Site administration > Plugins > Repositories > Manage repositories > Google Drive''.
 
To create a Google Developers Console project:
 
# Go to the [https://console.developers.google.com/ Google Developers Console] and sign in to your Google account.
# Follow the instructions provided in the Google Developers doc [https://developers.google.com/identity/sign-in/web/devconsole-project Creating a Google Developers Console project and client ID].
# When creating a new Client ID
#* In the Application type section of the dialog, select Web application.
#* Leave the Authorized JavaScript origins field empty and in the Authorized redirect URI field, enter the URL from your site.


Prior to Moodle 2.3, the [[Google Docs repository]] and [[Picasa web album repository]] and the [[Google Docs portfolio]] and [[Picasa portfolio]] could be used without any configuration or registration with Google. In April 2012, [http://googledevelopers.blogspot.com/2012/04/changes-to-deprecation-policies-and-api.html Google announced] to web application developers that they would be deprecating the service which Moodle was using to communicate with Google and strongly advised developers to move away from it. As a response to this change with Google's service, Moodle switched to use a new system for communicating with Google called 'OAuth 2.0'. The OAuth 2.0 system provides a better security system and more friendly experience to Moodle users, though it requires some additional configuration in Moodle.
Tip: If you have more than one Moodle site to register with Google, you can add an authorized redirect URI for each site. The same name and logo would then be displayed on the authorisation screen for each Moodle site.


==Registering with Google==
You will also need to enable the Drive API:
Each Moodle site now needs to be registered with Google in order to use the Google Docs or Picasa plugins. The following will guide you through the process of registering with Google.


# Visit the [https://code.google.com/apis/console#access Google APIs Console] and sign into your google account. You will be asked to create a project if this is your first time using this form.
# In Google API manager, under Google Apps APIs, follow the link 'Drive API'.
# Click the button 'Create an OAuth 2.0 client ID'
# Click the button to enable it.
# Enter the branding information 'Product name' (i.e. the name of your Moodle site) and 'Product logo' (i.e. your site logo). By providing a descriptive name and link to distinct image then your users will know they are signing into the correct place.  
# Click the Next button
# In 'Client ID Settings' select 'Web application' as application type.
# Click the '(more options)' link next to 'Your site or hostname' then in 'Authorized Redirect URIs' enter the URL which was provided in your Moodle settings page (usually <nowiki>http://yourmoodle/admin/oauth2callback.php</nowiki>) and leave the 'Authorized JavaScript Origins' field blank
# Click the button 'Create client ID'


Your site will then be registered with Google and you will be presented with your details.
==Configuring the Google Drive and Picasa repositories==


:8. Enter the 'Client ID' and 'Client secret' provided into your Moodle settings page
# Go to ''Administration > Site administration > Plugins > Repositories > Manage Repositories''
# Activate the Google Drive and/or Picasa repositories by selecting 'Enable and visible' in the dropdown menu
# Configure each repository by entering the client ID and secret. Make sure you don't include any white space in the text boxes!
# Save changes


Once configured, Google will present Moodle users with a nice authorisation screen with your Moodle site name and logo for your users to authorise.
==Configuring the Google Drive and Picasa portfolios==


# Go to ''Administration > Site administration > Plugins > Portfolios > Manage Portfolios''
# Activate the Google Drive and/or Picasa portfolios by selecting 'Enable and visible' in the dropdown menu
# Configure each portfolio by entering the client ID and secret
# Save changes


<gallery perrow=3 caption="Registering with Google - click on each to enlarge">
Once configured, Google will present Moodle users with a nice authorisation screen with your Moodle site name and logo for your users to authorise.
Image:google_oauth1.png|1. Create project
File:google_oauth2.png|2. Creating an OAuth 2.0 Client ID
File:google_oauth3.png|3. Branding information
File:google_oauth4.png|6. Client ID settings
File:google_oauth5.png|Registered details
File:google_oauth6.png|Authorisation screen
</gallery >


[[Category:Portfolios]]
[[Category:Portfolios]]
[[Category:Site administration]]
[[Category:Site administration]]
[[es:Configuración de Google OAuth 2.0]]

Latest revision as of 06:27, 23 February 2019

Note: This page contains information for site administrators only.

Registering with Google

Each Moodle site needs to be registered with Google i.e. have a Google Developers Console project in order to use the Google Drive, Docs or Picasa plugins. As part of the registration process, you will need to enter an authorized redirect URI (something like http://yourmoodlesite.org/admin/oauth2callback.php) which is provided on all Google Drive, Docs and Picasa plugins configuration pages in Moodle, such as Site administration > Plugins > Repositories > Manage repositories > Google Drive.

To create a Google Developers Console project:

  1. Go to the Google Developers Console and sign in to your Google account.
  2. Follow the instructions provided in the Google Developers doc Creating a Google Developers Console project and client ID.
  3. When creating a new Client ID
    • In the Application type section of the dialog, select Web application.
    • Leave the Authorized JavaScript origins field empty and in the Authorized redirect URI field, enter the URL from your site.

Tip: If you have more than one Moodle site to register with Google, you can add an authorized redirect URI for each site. The same name and logo would then be displayed on the authorisation screen for each Moodle site.

You will also need to enable the Drive API:

  1. In Google API manager, under Google Apps APIs, follow the link 'Drive API'.
  2. Click the button to enable it.

Configuring the Google Drive and Picasa repositories

  1. Go to Administration > Site administration > Plugins > Repositories > Manage Repositories
  2. Activate the Google Drive and/or Picasa repositories by selecting 'Enable and visible' in the dropdown menu
  3. Configure each repository by entering the client ID and secret. Make sure you don't include any white space in the text boxes!
  4. Save changes

Configuring the Google Drive and Picasa portfolios

  1. Go to Administration > Site administration > Plugins > Portfolios > Manage Portfolios
  2. Activate the Google Drive and/or Picasa portfolios by selecting 'Enable and visible' in the dropdown menu
  3. Configure each portfolio by entering the client ID and secret
  4. Save changes

Once configured, Google will present Moodle users with a nice authorisation screen with your Moodle site name and logo for your users to authorise.