これは私のクラッカーを運転しています。私はウェブサイト上に友人招待制度を実装しており、ユーザーのYahoo連絡先リストにアクセスする必要があります。これを行うには、OAuthとyahoo REST APIを使用しています。ここにイベントのシーケンスの完全な概要があります:私はYahooの連絡先APIに私の電話からHTTP 401 Unauthorizedを取得するのはなぜですか?
連絡先への読み取りアクセス権を持つように設定されているdevelopers.yahoo.comでプロジェクトをセットアップしました。私のホストファイルで127.0.0.1を指し示しているメークアップドメインにあります(ローカルホストが私の不幸を引き起こしていた可能性があります)。この理由から、私の理解は、これは単純に私は制限が少なく、それ以上ではないことを意味するが、ドメインは検証されない。
で返しhttps://api.login.yahoo.com/oauth/v2/get_request_token
?oauth_callback=http%3A%2F%2Fdev.mysite.com%2Fcallback.aspx
&oauth_consumer_key=MYCONSUMERKEY--
&oauth_nonce=xmaf8ol87uxwkxij
&oauth_signature=WyWWIsjN1ANeiRpZxa73XBqZ2tQ%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1328796736
&oauth_version=1.0
(明確であいまいな試み用にフォーマット済み):
oauth_token=hxcsqgj
&oauth_token_secret=18d01302348049830942830942630be6bee5
&oauth_expires_in=3600
&xoauth_request_auth_url
=https%3A%2F%2Fapi.login.yahoo.com%2Foauth%2Fv2%2Frequest_auth
%3Foauth_token%3Dhxcsqgj
&oauth_callback_confirmed=true"
が、私はその後、ポップアップにxoauth_request_auth_urlページを
はまず、サーバー上で私がリクエストトークンを取得しますユーザーは私のコールバックページに検証コードを受け取ります。私がアクセストークンに交換できるように、私はその後、私のサーバーにその背中を送信します。
https://api.login.yahoo.com/oauth/v2/get_token
?oauth_consumer_key=MYCONSUMERKEY--
&oauth_nonce=yxhd1nymwd03x189
&oauth_signature=c%2F6GTcybGJSQi4TOpvueLUO%2Fgrs%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1328796878
&oauth_token=hxcqgjs
&oauth_verifier=b8ngvp <- verifier given via callback
&oauth_version=1.0
動作するようだ、と私はトークンバックのアクセスを取得:
oauth_token=MYVERYLONGACCESSTOKEN--
&oauth_token_secret=MYOATHTOKENSECRET
&oauth_expires_in=3600
&oauth_session_handle=ADuXM093mTB4bgJPKby2lWeKvzrabvCrmjuAfrmA6mh5lEZUIin6
&oauth_authorization_expires_in=818686769
&xoauth_yahoo_guid=MYYAHOOGUID
私は、その後すぐにしようアクセストークンとGUIDと連絡先リストを取得するには:この呼び出しから
http://social.yahooapis.com/v1/user/MYYAHOOGUID/contacts
(HTTP Header added and formatted with line breaks for clarity...)
Authorization: OAuth
realm="yahooapis.com",
oauth_consumer_key="MYCONSUMERKEY--",
oauth_nonce="nzffzj5v82mgf4mx",
oauth_signature="moVJywesuGaPN5YHYKqra4T2ips%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1328796907",
oauth_token="MYVERYLONGACCESSTOKEN--",
oauth_version="1.0"
私は無断401を得るが、理由を見つけることは不可能と思われます。これらの通話に署名するには、this oath lib on githubを使用しています。私はそれが何か特別なことをしているとは思いません。署名については、コンシューマキー/シークレットとアクセストークン/シークレットを含めています。私は、ハッシュされている署名ベースを見てきました。これはyahooのドキュメントに表示されている例と同じ形式に見えます。私は、ハッシュされていないパラメータから何かを逃していると思います。コールが許可されていない理由を知る方法はありますか、誰がシグネチャベースと承認ヘッダーがどのような形で正確に表示されているかを示す例を知っていますか?
http://oauth.net/core/を1.0a /#http_codes – aitchnyu
こんにちはizb、私はhttp://developer.yahoo.com/oauth/guide/oauth-auth-flow.htmlの手順に従うが、私はステップ4で立ち往生した(要求トークンとOAuthを交換するアクセストークンの検証者)。アクセストークンを取得するためのURLを作成すると、「irefoxはhttps://api.login.yahoo.com/oauth/v2/get_token?oauth_consumer_key = ........でファイルを見つけることができません」というエラーが表示されます。 、 私を助けてください。 –