简体   繁体   English

Google服务帐户oauth重定向uri

[英]Google Service account oauth redirect uri

My application needs service account authorization. 我的应用程序需要服务帐户授权。 Everything is fine as long as I get the authorization. 只要获得授权,一切都很好。

My Question is: How do I know when a user gives me the authorization? 我的问题是:我怎么知道用户何时给我授权? There is no redirect uri as everyone notes so how do I get a callback? 大家都说没有重定向uri,那么如何获得回调? Is there an api that gives me the list of users that I have access to? 有没有可以给我访问权限的用户列表的api?

As of now I'm attempting to use oauthtoscombined to get the token for the simple account and the service account in the same process. 到目前为止,我正在尝试使用oauthtoscombined在同一过程中获取简单帐户和服务帐户的令牌。 But I cannot find any instructions on how. 但是我找不到任何说明。 So if this is the right way, could someone point me in the right direction or explain how it works? 因此,如果这是正确的方法,有人可以向我指出正确的方向或解释其工作原理吗? Simply modifying the redirect uri doesnt work. 简单地修改重定向uri无效。

I have the marketplace app setup and it works alright with the test oauth flow but again, I cant find out how to get a callback. 我有市场应用程序设置,并且可以在测试oauth流程中正常运行,但是再次,我无法找到如何获取回调。

Thanks! 谢谢!

Splitting the answer up a bit: 将答案分成几个部分:

How do I know when a user gives me the authorization?  
There is no redirect uri as everyone notes so how do I get a callback?

Service accounts are set up in APIs console to access your own data, not someone else's. 在API控制台中设置了服务帐户 ,以访问您自己的数据,而不是其他人的数据。 There is no call back because there is no user interaction in a service account. 没有回叫,因为服务帐户中没有用户交互。

The Google OAuth 2.0 endpoint supports server-to-server interactions such as those between a web application and Google Cloud Storage. Google OAuth 2.0端点支持服务器到服务器的交互,例如Web应用程序和Google Cloud Storage之间的交互。 For this scenario you need a service account, which is an account that belongs to your application instead of to an individual end user. 对于这种情况,您需要一个服务帐户,该帐户是属于您的应用程序而不是单个最终用户的帐户。 For example, if you use the Google Prediction API to act on behalf of your application without accessing any user data, your application uses its service-account credentials to prove its own identity, and no end user is involved 例如,如果您使用Google Prediction API代表应用程序执行操作而不访问任何用户数据,则您的应用程序将使用其服务帐户凭据来证明自己的身份,并且不涉及最终用户

Suggestion: Use Oauth2 if you would like to access information owned by someone else. 建议:如果要访问其他人拥有的信息,请使用Oauth2

Is there an api that gives me the list of users that I have access to? 

No there is not. 不,那里没有。 Once you have Oauth2 set up you will need to save the Refresh Tokens returned by the Authentication server. 设置完Oauth2后,您需要保存身份验证服务器返回的刷新令牌。 A refresh token is returned for each of the users that have granted you access to there accounts. 将为每个授予您访问那里帐户权限的用户返回刷新令牌。 You will then be able request data again on there behalf by using the Refresh Token to get a new access token. 然后,您可以使用“刷新令牌”获得一个新的访问令牌,再次代表那里请求数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM