2012-01-03 14 views

答えて

0

するTryのOAuth 2.0:http://code.google.com/apis/youtube/2.0/developers_guide_protocol.html#OAuth2_Installed_Applications_Flow

まず、CLIENT_IDを取得するAPIを登録します。

次に、パートナーにGoogleアカウントにログインするように依頼し、次のURLを入力して、自分のclient_idを変更します。 redirect_uriは "urn:ietf:wg:oauth:2.0:oob"に設定する必要があります。

https://accounts.google.com/o/oauth2/auth?client_id=1084945748469-eg34imk572gdhu83gj5p0an9fut6urp5.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=https://gdata.youtube.com&response_type=code&access_type=offline

その後、彼らはあなたのアプリケーションを承認し、認証コードを取得します。

curl https://accounts.google.com/o/oauth2/token -d "code=4/ux5gNj-_mIu4DOD_gNZdjX9EtOFf&client_id=1084945748469-eg34imk572gdhu83gj5p0an9fut6urp5.apps.googleusercontent.com&client_secret=hDBmMRhz7eJRsM9Z2q1oFBSe&redirect_uri=urn:ietf:wg:oauth:2.0:oob&grant_type=authorization_code" 

あなたが得る応答のような:

{ "access_token" : "ya29.AHES6ZTtm7SuokEB-RGtbBty9IIlNiP9-eNMMQKtXdMP3sfjL1Fc", "token_type" : "Bearer", "expires_in" : 3600, "refresh_token" : "1/HKSmLFXzqP0leUihZp2xUt3-5wkU7Gmu2Os_eBnzw74" }

がrefresh_tokenを覚えて、そして毎回

は、その後、端末とタイプ(あなたのコード、CLIENT_IDを変更し、client_secret)を開きますアプリケーションを実行する場合は、refresh_tokenで新しいaccess_tokenを取得する必要があります。

関連する問題