Note: This documentation is for Moodle 2.7. For up-to-date documentation see Google OAuth 2.0 setup.

Google OAuth 2.0 setup: Difference between revisions

From MoodleDocs
(Converting to thumnails. This view still sucks though. I'm not a mediawiki guru.)
 
(29 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Prior to Moodle 2.3, Google Docs and Picasa repository plugins and portfolio plugins 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 providers and a better security system and more friendly experience to Moodle users, though it requires some additional configuration in Moodle.
{{Repositories}}
''Note: This page contains information for site administrators only.''


==Registering with Google==
==Registering with Google==
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.


# You will need to be signed into a google account
Each Moodle site  needs to be registered with Google in order to use the Google Drive, Docs or Picasa plugins. As part of the registration process, you will need to enter a URL (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 e.g. ''Administration > Site administration > Plugins > Repositories > Google Drive''.
# Visit the [Google API's Console https://code.google.com/apis/console#access]
# You will be asked to create a project if this is your first time using this form. [[Image:google_oauth1.png|thumb|3. creating API Project]]
# You need to click the button marked 'Create an OAuth 2.0 client ID..' [[File:google_oauth2.png|thumb|4. creating an OAuth 2.0 Client ID]]
# You will be asked to enter branding information including a 'Product name' and 'Product logo'. By providing a descriptive name and link to distinct image then your users will know they are signing into the correct place. [[File:google_oauth3.png|thumb|5. client Settings]]
# Next you will be asked for 'Client ID Settings'
## For Application type, select 'Web application'
## Next to 'Your site or hostname' click '(more options)'
## In 'Authorized Redirect URIs' enter the URL which was provided in your Moodle settings page. (usually http://yourmoodle/admin/oauth2callback.php)
## In 'Authorized JavaScript Origins' leave the field blank [[File:google_oauth4.png|thumb|9. callback options]]
# Click 'Create client ID'
# Your site is now registered with Google and you will be presented with your details. [[File:google_oauth5.png|thumb|12. registered details]]
# Enter the 'Client ID' and 'Client secret' provided into your Moodle settings page


==Resulting Authorisation Screen==
1) Visit the [https://console.developers.google.com/ Google Developers Console] (previously, the [https://cloud.google.com/console/project#access Google Cloud APIs Console], or the [https://code.google.com/apis/console#access Google APIs Console]) and sign into your google account.
Once configured, Google will present Moodle users with a nice authorisation screen with your moodle name and logo for your users to authorise:
2) If it is your first time you will be asked to create a project:
[[File:google_oauth6.png]]
[[File:01g.png|center|thumb|400px]]
3) Give your project a name
[[File:02g.png|thumb|center|400px]]
4) If not already enabled, the Google Drive API needs enabling. Click "Enable an API":
[[File:03g.png|thumb|center|400px]]
5) Change Drive API to "On":
[[File:04g.png|thumb|center|400px]]
6) From the left menu, click "Credentials":
[[File:05g.png|thumb|center|400px]]
7) In the OAuth block, click "Create  new client ID"
[[File:06g.png|thumb|center|400px]]
8) Leave the Javascript redirect blank and add the redirect URL you have from ''Administration > Site administration > Plugins > Repositories > Google Drive'' and then click "Create client ID".You can also enter your branding details here.
[[File:08g.png|thumb|center|400px]]
9) Go to the Consent Screen and enter an Email address and a Product name:
[[File:google-oa2-consent-screen.png|thumb|center|400px]]
10) On your set up page enter the ID and secret you got at step 8:
[[File:09g.png|thumb|center|400px]]
 
 
Tip: If you have more than one Moodle site to register with Google, you can add an authorized redirect URI for each site in step 8. The same name and logo would then be displayed on the authorisation screen for each Moodle site.
 
==Configuring the Google Drive and Picasa repositories==
 
# 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
 
==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
 
 
Once configured, Google will present Moodle users with a nice authorisation screen with your Moodle site name and logo for your users to authorise.
 
[[Category:Portfolios]]
[[Category:Site administration]]
 
[[es:Configuración de Google OAuth 2.0]]

Latest revision as of 18:25, 15 October 2014

Note: This page contains information for site administrators only.

Registering with Google

Each Moodle site needs to be registered with Google in order to use the Google Drive, Docs or Picasa plugins. As part of the registration process, you will need to enter a URL (something like http://yourmoodlesite.org/admin/oauth2callback.php) which is provided on all Google Drive, Docs and Picasa plugins configuration pages in Moodle e.g. Administration > Site administration > Plugins > Repositories > Google Drive.

1) Visit the Google Developers Console (previously, the Google Cloud APIs Console, or the Google APIs Console) and sign into your google account. 2) If it is your first time you will be asked to create a project:

01g.png

3) Give your project a name

02g.png

4) If not already enabled, the Google Drive API needs enabling. Click "Enable an API":

03g.png

5) Change Drive API to "On":

04g.png

6) From the left menu, click "Credentials":

05g.png

7) In the OAuth block, click "Create new client ID"

06g.png

8) Leave the Javascript redirect blank and add the redirect URL you have from Administration > Site administration > Plugins > Repositories > Google Drive and then click "Create client ID".You can also enter your branding details here.

08g.png

9) Go to the Consent Screen and enter an Email address and a Product name:

google-oa2-consent-screen.png

10) On your set up page enter the ID and secret you got at step 8:

09g.png


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

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.