如何使用Google.Apis.Auth.OAuth2.Flows.GoogleAuthorization codeFLOW从OAuth 2.0用户收到电子邮件ID? [英] How to get Email ID from oAuth 2.0 using Google.Apis.Auth.OAuth2.Flows.GoogleAuthorizationCodeFlow?
问题描述
我的问题基本上是如何从OAuth 2.0用户收到电子邮件ID使用Google.Apis.Auth.OAuth2.Flows.GoogleAuthorization codeFLOW?
My Question is basically How to get Email ID from oAuth 2.0 using Google.Apis.Auth.OAuth2.Flows.GoogleAuthorizationCodeFlow ?
我使用MVC 4应用程序与GoogleAuthorization codeFLOW是OAuth 2.0实现。
页转到谷歌和在用户输入电子邮件ID和密码。
I am using MVC 4 application with GoogleAuthorizationCodeFlow for oAuth 2.0 implementation. After the page goes to the google and the user enters Email ID and password.
如何能获取电子邮件ID从API?
How could i Get the Email ID from the API?
推荐答案
我认为你的答案就在这里找到。链接到页面在这个岗位的底部。
I think your answer is found here. Link to the page is at the bottom of this post.
的第一步是基于已知的用户ID来调用#loadCredential(字符串)来检查最终用户的凭证是已知的,如果不是,调用newAuthorizationUrl()和指示最终用户的浏览器的授权页面。Web浏览器便会重定向到URL重定向与当时可用于要求使用newTokenRequest(字符串)访问令牌一个code查询参数。最后,使用#createAndStoreCredential(TokenResponse,字符串)来存储并获得证书访问受保护的资源。
"The first step is to call #loadCredential(String) based on the known user ID to check if the end-user's credentials are already known. If not, call newAuthorizationUrl() and direct the end-user's browser to an authorization page. The web browser will then redirect to the redirect URL with a "code" query parameter which can then be used to request an access token using newTokenRequest(String). Finally, use #createAndStoreCredential(TokenResponse, String) to store and obtain a credential for accessing protected resources."
<一个href=\"http://javadoc.google-api-java-client.google$c$c.com/hg-history/0dd03fb10eb0ec8e66259d5a19e712bb274b68bc/1.10.0-beta/jdiff/Google%20API%20Client%20Library%20for%20Java%201.9.0-beta/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorization$c$cFlow.html\" rel=\"nofollow\">http://javadoc.google-api-java-client.google$c$c.com/hg-history/0dd03fb10eb0ec8e66259d5a19e712bb274b68bc/1.10.0-beta/jdiff/Google%20API%20Client%20Library%20for%20Java%201.9.0-beta/com/google/api/client/googleapis/auth/oauth2/GoogleAuthorization$c$cFlow.html
这篇关于如何使用Google.Apis.Auth.OAuth2.Flows.GoogleAuthorization codeFLOW从OAuth 2.0用户收到电子邮件ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!