签名尝试检索accesToken复印无效的API [英] Signature invalid while trying to retrieve accesToken for copy api

查看:212
本文介绍了签名尝试检索accesToken复印无效的API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图加载使用标头URL和试图让我的accessToken

下面是code

 字符串oauthToken =网址[0];
            字符串tokenVerifier =网址[1];
            字符串responseBody = NULL;尝试{
                字符串URL =htt​​ps://api.copy.com/oauth/access?oauth_verifier=+ tokenVerifier;
                字符串UNIQUEID = UUID.randomUUID()的toString()。                串授权=OAuth的oauth_version = \\1.0 \\,oauth_signature_method = \\PLAINTEXT \\,oauth_consumer_key = \\+ Constants.COPY_CONSUMER_KEY
                        +\\,oauth_signature = \\+ Constants.COPY_SECRET +与& + tokenVerifier\\,oauth_nonce = \\+ UNIQUEID
                        +\\,oauth_timestamp = \\+将String.valueOf(Calendar.getInstance()getTimeInMillis()。)+\\,组oauth_token = \\+ oauthToken +\\;

应答给我误差

<$p$p><$c$c>oauth_problem=signature_invalid&debug_sbs=GET&https%3A%2F%2Fapi.copy.com%2Foauth%2Faccess&oauth_consumer_key%3DCtu6CtdN1PWRo5DstoxgaaIQWZkeeWNg%26oauth_nonce%3D10525625%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1425400347545%26oauth_token%3D6aNkypb7wZoI7dbJiSrtItOTGmpaG0RL%26oauth_verifier%3D496cb46091352c4788603dcfb6e0cfb5%26oauth_version%3D1.0oauth_error_$c$c=2000

什么是错我的签名,同样的方法工作的ios


解决方案

您发送您在要计算使用接收到的标识和request_token_secret一个新的令牌刚刚收到ouath_token。这个新的令牌就是你需要发送的组oauth_token参数您的要求。

这里检查我的蟒蛇code

I am trying to load a url with headers and trying to get my accessToken

Here is the code

String oauthToken = urls[0];
            String tokenVerifier = urls[1];
            String responseBody = null;

try {
                String url = "https://api.copy.com/oauth/access?oauth_verifier=" + tokenVerifier;
                String uniqueID = UUID.randomUUID().toString();

                String authorization = "OAuth oauth_version=\"1.0\", oauth_signature_method=\"PLAINTEXT\", oauth_consumer_key=\""+ Constants.COPY_CONSUMER_KEY
                        +"\", oauth_signature=\""+ Constants.COPY_SECRET +"&" + tokenVerifier "\", oauth_nonce=\""+ uniqueID 
                        +"\", oauth_timestamp=\""+String.valueOf(Calendar.getInstance().getTimeInMillis())+"\" , oauth_token=\""+ oauthToken +"\"";

The response gives me error

oauth_problem=signature_invalid&debug_sbs=GET&https%3A%2F%2Fapi.copy.com%2Foauth%2Faccess&oauth_consumer_key%3DCtu6CtdN1PWRo5DstoxgaaIQWZkeeWNg%26oauth_nonce%3D10525625%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1425400347545%26oauth_token%3D6aNkypb7wZoI7dbJiSrtItOTGmpaG0RL%26oauth_verifier%3D496cb46091352c4788603dcfb6e0cfb5%26oauth_version%3D1.0oauth_error_code=2000

What is wrong with my signature, same method is working for ios

解决方案

You are sending the ouath_token that you have just received when you have to calculate a new Token using that received token and the request_token_secret. This new token is what you need to send as oauth_token parameter in your request.

Check my python code here.

这篇关于签名尝试检索accesToken复印无效的API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆