⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.118
Server IP:
2.57.91.209
Server:
Linux sg-nme-web1518.main-hosting.eu 5.14.0-611.16.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Dec 22 03:40:39 EST 2025 x86_64
Server Software:
LiteSpeed
PHP Version:
8.3.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
gsutil
/
gslib
/
vendored
/
oauth2client
/
samples
/
View File Name :
oauth2_for_devices.py
# -*- coding: utf-8 -*- # See: https://developers.google.com/accounts/docs/OAuth2ForDevices from googleapiclient.discovery import build import httplib2 from six.moves import input from oauth2client.client import OAuth2WebServerFlow CLIENT_ID = "some+client+id" CLIENT_SECRET = "some+client+secret" SCOPES = ("https://www.googleapis.com/auth/youtube",) flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, " ".join(SCOPES)) # Step 1: get user code and verification URL # https://developers.google.com/accounts/docs/OAuth2ForDevices#obtainingacode flow_info = flow.step1_get_device_and_user_codes() print("Enter the following code at {0}: {1}".format(flow_info.verification_url, flow_info.user_code)) print("Then press Enter.") input() # Step 2: get credentials # https://developers.google.com/accounts/docs/OAuth2ForDevices#obtainingatoken credentials = flow.step2_exchange(device_flow_info=flow_info) print("Access token: {0}".format(credentials.access_token)) print("Refresh token: {0}".format(credentials.refresh_token)) # Get YouTube service # https://developers.google.com/accounts/docs/OAuth2ForDevices#callinganapi youtube = build("youtube", "v3", http=credentials.authorize(httplib2.Http()))