The documentation google + domains api to create a post using the 'service' object, obtained here by this method. But in my project to authenticate via google and other sites I use the python social auth and after authorization I have a ready access token.
The problem lies in the fact that I need a service object to work with api, but I can not figure out how to get it already having access token. Please help me and sorry for my english.
文档google + domains api使用此方法获取的“服务”对象创建帖子。但在我通过谷歌和其他网站进行身份验证的项目中,我使用的是python social auth,授权后我有一个现成的访问令牌。问题在于我需要一个服务对象来使用api,但我无法弄清楚如何让它已经拥有访问令牌。请帮帮我,抱歉我的英语。
1 个解决方案
#1
For the domains API, you typically will implement using a service account authorization flow - which is not retrieved in the same way as a user OAuth flow. This is because service accounts can be authorized for services that users typically should not be authorized for (e.g. retrieving domain-wide lists of user names).
对于域API,您通常将使用服务帐户授权流实现 - 不会以与用户OAuth流相同的方式检索。这是因为服务帐户可以被授权用户通常不应该被授权的服务(例如,检索域范围的用户名列表)。
The service account credentials, used to authorize your application, are created using the Google Developer Console and then are downloaded as a JSON or p12 file that is used to authenticate your Python client, as shown in this example.
用于授权应用程序的服务帐户凭据是使用Google Developer Console创建的,然后作为JSON或p12文件下载,用于验证Python客户端,如本例所示。
That said, you still can do some actions with that access token which is why the auth flow you're seeing is doing this. Service credentials are how you should be authorizing for domains-related management features which may explain the behavior you're seeing.
也就是说,您仍然可以使用该访问令牌执行某些操作,这就是您所看到的身份验证流程正在执行此操作的原因。服务凭据是您应该如何授权与域相关的管理功能,这可以解释您所看到的行为。
#1
For the domains API, you typically will implement using a service account authorization flow - which is not retrieved in the same way as a user OAuth flow. This is because service accounts can be authorized for services that users typically should not be authorized for (e.g. retrieving domain-wide lists of user names).
对于域API,您通常将使用服务帐户授权流实现 - 不会以与用户OAuth流相同的方式检索。这是因为服务帐户可以被授权用户通常不应该被授权的服务(例如,检索域范围的用户名列表)。
The service account credentials, used to authorize your application, are created using the Google Developer Console and then are downloaded as a JSON or p12 file that is used to authenticate your Python client, as shown in this example.
用于授权应用程序的服务帐户凭据是使用Google Developer Console创建的,然后作为JSON或p12文件下载,用于验证Python客户端,如本例所示。
That said, you still can do some actions with that access token which is why the auth flow you're seeing is doing this. Service credentials are how you should be authorizing for domains-related management features which may explain the behavior you're seeing.
也就是说,您仍然可以使用该访问令牌执行某些操作,这就是您所看到的身份验证流程正在执行此操作的原因。服务凭据是您应该如何授权与域相关的管理功能,这可以解释您所看到的行为。