大佬教程收集整理的这篇文章主要介绍了android – Oauth 2无法交换访问令牌的代码,返回“invalid_grant”,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>( 0); nameValuePairs.add(new BasicNameValuePair("client_id",OAuth2ClientCredentialsmark1.CLIENT_ID)); nameValuePairs.add(new BasicNameValuePair("client_secret",OAuth2ClientCredentialsmark1.CLIENT_SECRET)); nameValuePairs.add(new BasicNameValuePair("code",accessCodE)); nameValuePairs.add(new BasicNameValuePair("grant_type","authorization_code")); nameValuePairs.add(new BasicNameValuePair("redirect_uri",OAuth2ClientCredentialsmark1.REDIRECT_URI)); //"http://localhost" String url = "https://accounts.google.com/o/oauth2/token"; //url += URLEncodedUtils.format(nameValuePairs,"utf-8"); Log.d("print",url); httpPost hPost = new httpPost( url); hPost.setHeader("content-type","application/x-www-form-urlencoded"); hPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
此@L_616_2@始终返回{“Error”:“invalid_grant”}给出了什么?
我的应用程序基于样本@ https://github.com/ddewaele/LatitudeOAuth2Sample,我一直在关注教程@ http://code.google.com/apis/accounts/docs/OAuth2InstalledApp.html
最有可能的是,您的应用程序尚未得到用户的授权.
回答你关注的问题:
你能澄清一下oauth2 flow (scenario),你在开发什么?
以上是大佬教程为你收集整理的android – Oauth 2无法交换访问令牌的代码,返回“invalid_grant”全部内容,希望文章能够帮你解决android – Oauth 2无法交换访问令牌的代码,返回“invalid_grant”所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。