1. <tfoot id='PT6Td'></tfoot>

      <i id='PT6Td'><tr id='PT6Td'><dt id='PT6Td'><q id='PT6Td'><span id='PT6Td'><b id='PT6Td'><form id='PT6Td'><ins id='PT6Td'></ins><ul id='PT6Td'></ul><sub id='PT6Td'></sub></form><legend id='PT6Td'></legend><bdo id='PT6Td'><pre id='PT6Td'><center id='PT6Td'></center></pre></bdo></b><th id='PT6Td'></th></span></q></dt></tr></i><div id='PT6Td'><tfoot id='PT6Td'></tfoot><dl id='PT6Td'><fieldset id='PT6Td'></fieldset></dl></div>
      <legend id='PT6Td'><style id='PT6Td'><dir id='PT6Td'><q id='PT6Td'></q></dir></style></legend>
        <bdo id='PT6Td'></bdo><ul id='PT6Td'></ul>

    1. <small id='PT6Td'></small><noframes id='PT6Td'>

      Android - 如何获取 google plus 访问令牌?

      Android - how to get google plus access token?(Android - 如何获取 google plus 访问令牌?)

      <small id='MoMss'></small><noframes id='MoMss'>

      • <tfoot id='MoMss'></tfoot>
      • <i id='MoMss'><tr id='MoMss'><dt id='MoMss'><q id='MoMss'><span id='MoMss'><b id='MoMss'><form id='MoMss'><ins id='MoMss'></ins><ul id='MoMss'></ul><sub id='MoMss'></sub></form><legend id='MoMss'></legend><bdo id='MoMss'><pre id='MoMss'><center id='MoMss'></center></pre></bdo></b><th id='MoMss'></th></span></q></dt></tr></i><div id='MoMss'><tfoot id='MoMss'></tfoot><dl id='MoMss'><fieldset id='MoMss'></fieldset></dl></div>
          <tbody id='MoMss'></tbody>
            <legend id='MoMss'><style id='MoMss'><dir id='MoMss'><q id='MoMss'></q></dir></style></legend>

              <bdo id='MoMss'></bdo><ul id='MoMss'></ul>

              1. 本文介绍了Android - 如何获取 google plus 访问令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                您好,我在不使用带范围的 OAuth 2.0 客户端 ID 的情况下获取 google plus 访问令牌.但是使用此访问令牌不会获取电子邮件地址.如何获取用户邮箱?

                Hello i am getting google plus access token without using OAuth 2.0 client ID with scopes. But with this access token does not fetch email address. How to fetch user email address?

                带有和不带有 OAuth 2.0 客户端 ID 的 accesstoken 有什么区别吗?

                Is there any difference between accesstoken with and without OAuth 2.0 client ID?

                我使用了以下代码,

                String accessToken="";
                                    try {
                                        accessToken = GoogleAuthUtil.getToken(
                                                getApplicationContext(),
                                                mPlusClient.getAccountName(), "oauth2:"
                                                        + Scopes.PLUS_LOGIN + " "
                                                        + Scopes.PLUS_PROFILE);
                
                                        System.out.println("Access token==" + accessToken);
                                    } catch (Exception e) {
                                        e.printStackTrace();
                                    }
                

                推荐答案

                String accessToken = "";
                try {
                  URL url = new URL("https://www.googleapis.com/oauth2/v1/userinfo");
                  // get Access Token with Scopes.PLUS_PROFILE
                  String sAccessToken;
                  sAccessToken = GoogleAuthUtil.getToken(
                    LoginCheckActivity.this,
                    mPlusClient.getAccountName() + "",
                    "oauth2:"
                      + Scopes.PLUS_PROFILE + " "
                      + "https://www.googleapis.com/auth/plus.login" + " "
                      + "https://www.googleapis.com/auth/plus.profile.emails.read");
                } catch (UserRecoverableAuthException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();                  
                  Intent recover = e.getIntent();
                  startActivityForResult(recover, 125);
                  return "";
                } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                } catch (GoogleAuthException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
                }
                

                这篇关于Android - 如何获取 google plus 访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Android - Is it possible to get install referrer programmatically(Android - 是否有可能以编程方式安装引荐来源网址)
                How to sign an APK with more than one certificate?(如何使用多个证书签署 APK?)
                versionCode vs versionName in Android Manifest(Android Manifest 中的 versionCode 与 versionName)
                What does this Google Play APK publish error message mean?(这个 Google Play APK 发布错误消息是什么意思?)
                Lost my keystore for uploaded app on android market(丢失了我在 android 市场上上传的应用程序的密钥库)
                App on Google Play always shows quot;Updatequot; instead of open(Google Play 上的应用程序总是显示“更新;而不是打开)

                    <tbody id='hHkKp'></tbody>
                    <bdo id='hHkKp'></bdo><ul id='hHkKp'></ul>
                  • <tfoot id='hHkKp'></tfoot>

                    <small id='hHkKp'></small><noframes id='hHkKp'>

                      <i id='hHkKp'><tr id='hHkKp'><dt id='hHkKp'><q id='hHkKp'><span id='hHkKp'><b id='hHkKp'><form id='hHkKp'><ins id='hHkKp'></ins><ul id='hHkKp'></ul><sub id='hHkKp'></sub></form><legend id='hHkKp'></legend><bdo id='hHkKp'><pre id='hHkKp'><center id='hHkKp'></center></pre></bdo></b><th id='hHkKp'></th></span></q></dt></tr></i><div id='hHkKp'><tfoot id='hHkKp'></tfoot><dl id='hHkKp'><fieldset id='hHkKp'></fieldset></dl></div>
                          <legend id='hHkKp'><style id='hHkKp'><dir id='hHkKp'><q id='hHkKp'></q></dir></style></legend>