首页 > 解决方案 > 如何在没有客户端 ID 和客户端 ID 密码的情况下获取用户的 Google 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)

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

标签: pythongoogle-apiyoutube-api

解决方案


推荐阅读