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 访问令牌?

      时间:2023-11-09

      <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 市场上的应用程序 - 没有 HTTP 通知 下一篇:解决 Google Play 的 Billing API v3 中消耗品的 API-purchase-logic-fla

                相关文章

                    <bdo id='hHkKp'></bdo><ul id='hHkKp'></ul>
                1. <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>
                  1. <legend id='hHkKp'><style id='hHkKp'><dir id='hHkKp'><q id='hHkKp'></q></dir></style></legend>