You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create or Select a Project in Google Cloud Console:
3
+
4
+
Go to the Google Cloud Console.
5
+
If you haven't already created a project, you will need to create one. Otherwise, select an existing project.
6
+
7
+
Enable the Google Drive API:
8
+
In the dashboard of your project, navigate to the "APIs & Services > Library".
9
+
Search for "Google Drive API" and select it.
10
+
Click "Enable" to enable the Google Drive API for your project.
11
+
12
+
Create Credentials:
13
+
After enabling the API, go to "APIs & Services > Credentials".
14
+
Click "Create Credentials" at the top of the page.
15
+
Choose “OAuth client ID”.
16
+
17
+
Configure the OAuth consent screen:
18
+
You'll be prompted to configure the OAuth consent screen before creating credentials. This is the screen that users will see when they authenticate with your application.
19
+
Make sure to add a test user that is your mail.
20
+
21
+
Create OAuth 2.0 Client ID:
22
+
After configuring the consent screen, you’ll be taken back to the "Create credentials" screen.
23
+
For "Application type", select "Web application" or another type relevant to your application.
24
+
Set a name for the OAuth 2.0 client.
25
+
Under "Authorized redirect URIs", add http://localhost:8080/.
26
+
Click “Create”.
27
+
Download the Credentials:
28
+
29
+
credentials.json
30
+
After creating the client ID, you'll see a confirmation screen showing your client ID and client secret.
31
+
Click the download button (it looks like a download icon) to download the JSON file containing your credentials.
32
+
Rename this file to credentials.json and place it in the directory of your Python script.
33
+
34
+
Install Required Libraries:
35
+
If you haven’t installed the required libraries for the Google API client and OAuth, you can install them via pip:
# If there are no (valid) credentials available, let the user log in.
59
+
ifnotcredsornotcreds.valid:
60
+
ifcredsandcreds.expiredandcreds.refresh_token:
61
+
creds.refresh(Request())
62
+
else:
63
+
assertos.path.isfile(
64
+
"secrets/credentials.json"
65
+
), "You need secrets/credentials.json. Download it from client secrets in: https://console.cloud.google.com/apis/credentials/oauthclient/385659825496-0123vosqnmabsha0bkdfahktrhqg5d8v.apps.googleusercontent.com?project=slides-to-pdf-412609"
0 commit comments