OAuth 2 Google service: различия между версиями

Материал из База знаний Центра ПУСК МФТИ
1>Tsala
See also forum discussion links
 
м 1 версия импортирована
 
(нет различий)

Текущая версия от 06:43, 18 октября 2024

Features requiring the OAuth 2 Google service

You will need to set up an OAuth 2 Google service in order to use the following features:

OAuth 2 Google service setup

To set up an OAuth 2 client with Google, log in to the Google Developers Console and click the arrow by 'Select a project'.

Файл:SelectAProject.png

Click 'Create a new project'

Файл:New project.png

Give it a name. The name is not visible to anyone so you can choose any name you like.

Файл:Google-2-create-new-modal.png
Name the project

Click Credentials from the menu on the left.

Файл:Google-3-credentials.png
Switch to credentials page

Setup the consent screen for your application. This is where you provide the public information that is shown to users when they are asked to authorise your application. Setting a product name is the minimum information that is required, but the more information you provide here - the more confidence users will have when granting this authorisation.

Файл:App information.png
Setup consent screen

Now you can create some client credentials. Click Credentials from the menu on the left again then click "+ Create credentials" and select OAuth client ID.

Файл:Google-5-oauth-credentials.png
Create an OAuth Client ID

Select Web application as Application type and click to add an authorised redirect URI. This must be set to "your moodle site url + /admin/oauth2callback.php". If your Moodle site was accessible at https://lemon.edu/ then this callback URL should be set to https://lemon.edu/admin/oauth2callback.php. Enter the URL then click Create.

Файл:Google-6-web-application-credentials.png
Set the callback URL

When you have saved the information on this page, Google will give you the client ID and client secret that you need to enter into Moodle.

Файл:Google-7-oauth-details.png
Got my secrets!

Finally we have to enable the Drive API (if we want to use the google drive repository or file converter plugins).

Click Library from the menu on the left.

Файл:Google-8-library.png
View the Library tab

Search for drive and select Google Drive API. Click the Enable button.

Файл:Google-10-enable-drive.png
Enable the API

App verification

NOTE: If you are just using this for document conversion you will not need to verify (as it only uses one account). You will, however, need to verify your ownership of your domain (see Verify your site ownership - Search Console Help.)

The Google Drive repository and Google Drive converter also require the app to be verified by completing the OAuth Developer Verification Form. The list of scopes that Moodle requires are: openid profile email https://www.googleapis.com/auth/drive.

See also

Moodle in English forum discussions:

es:Servicio OAuth 2 Google de:OAuth2 Google Service