When i try to authenticate oauth1 rest api returnse Invalide
I have to access the Snoobi api for analytics. They are providing differnt steps to authenticate the Snoobi api through Oauth1. they are Snoobi have two api call for the authentication the first request i can access https://api.snoobi.com/oauth/requesttoken?oauth_callback= and get request url. Bu in case of second request https://api.snoobi.com/oauth/accesstoken is return invlid_signature. I can't figuare out this issue.... My sample site is Sample site with these authentication did by DDO oauth1 library. The authentication steps are given below. Step 1: Request token The request token endpoint for Snoobi API is at:
https://api.snoobi.com/oauth/requesttoken
The request is made with with HTTP POST to URL:
https://api.snoobi.com/oauth/requesttoken?oauth_callback=<your application callback, URL encoded>
Authorization headers The OAuth parameters are sent in HTTP Authorization header
Field Value oauth_consumer_key Your applications consumer key (40 chars) oauth_nonce Randomly generated string in ASCII format. Subsequent requests with same nonce and timestamp combination will be ignored. Recommendation is to use 64-bit random number. oauth_signature Request signature oauth_signature_method HMAC-SHA1″ or ”PLAINTEXT oauth_timestamp Unix timestamp oauth_version 1.0
Example authorization header (line breaks added for readability):
Authorization: OAuth oauth_consumer_key=”2cab9166c5180256f4788a7669c181c84bec61ee”,oauth_signature_method=”HMAC-SHA1″,oauth_nonce=”7524122124ddba21d644043.98235934″
,oauth_timestamp=”1306239517″,
oauth_version=”1.0″,
oauth_signature=”kP6LwV%2FJfs9YcG4irDJuoP271uU%3D”
On successful request /oauth/requesttoken returns the request token and token secret. These come in parameters ”oauth_token” and ”oauth_token_secret”, respectively. Also the authentification url is provided in the response parameter ”authentification_url”. The URL is something akin to: https://api.snoobi.com/oauthgrant.php and your application should redirect the user's browser to this address. If user is not already logged in to Snoobi, he will be prompted to do so. After login, user gets to the view where they can grant the access to the application:
Snoobi's OAuth grant view
Once user clicks the Grant button he gets redirected to your callback url, with oauth_token and verifier added as url parameters:
http://youapp.com/callback.php?oauth_token=66393e59b10dddc112a8d1cbca9f9559d01127a1&verifier_token=051dd4f45b791957d8c12b83b9810365bbb50e63
Step 2: Access tokens Now that your application has acquired the request token, secret and verifier, it is ready to call the access token end point to get the permanent access tokens. The access token endpoint is:
https://api.snoobi.com/oauth/accesstoken
Authorization headers Field Value oauth_consumer_key Your applications consumer key (40 chars) oauth_nonce Randomly generated string in ASCII format. Subsequent requests with same nonce and timestamp combination will be ignored. Recommendation is to use 64-bit random number. oauth_timestamp Unix timestamp oauth_version 1.0 oauth_token Your request token oauth_signature Signature
Authorization: OAuth oauth_verifier=”ff17678750b3ca5b5263babee610bb9f47f7a1b6″,oauth_consumer_key=”2cab9166c5180256f4788a7669c181c84bec61ee”,oauth_signature_method=”HMAC-SHA1″,
oauth_nonce=”2556773534ddb9f01d00518.41306989″,
oauth_timestamp=”1306238721″,
oauth_version=”1.0″,
oauth_token=”f3a4eb25c1267f28d5de54e89a78db48f4d7ed30″,
oauth_signature=”%2F9y%2BtMdCZk1uRYawXsfWHb%2BPmig%3D”
On success, the accesstoken service returns the access token and secret in fields: oauth_token and oauth_token_secret.
When I try the auth verifier changed to post form data then it grants the access. I thought the documentation is wrong defines that.
链接地址: http://www.djcxy.com/p/61162.html上一篇: 形态学中连接字符的图像分割