如何获取没有客户端ID和客户端ID密码的用户的Google API令牌?

时间:2020-03-10 18:14:05

标签: python google-api youtube-api

我正在制作一个需要访问Google帐户的应用。目前,我正在使用创建项目,创建密钥和许多中间步骤的漫长方法,这对于用户来说太长了。

这是验证用户身份的部分:

google_scopes = ["https://www.googleapis.com/auth/youtube.readonly"]

api_service_name = "youtube"
api_version = "v3"
client_secrets_file = "config.json"

# Get credentials and create an API client
flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
    client_secrets_file, google_scopes)
credentials = flow.run_console()
youtube = googleapiclient.discovery.build(
    api_service_name, api_version, credentials=credentials)

我只希望它在没有配置文件的情况下完成。只是需要用户登录的链接,然后返回令牌。

0 个答案:

没有答案
相关问题