ãã¹ãŠã®æ©äŒã«ããŸããããªãã§ç»é²ãå¿
èŠãšãããªãœãŒã¹ã«éåžžã«ç²ããŠããã®ã¯ãç§ã ãã§ã¯ãªããšæããŸãã 5åç®ããã®ã¿æ£ããå
¥åãããå¿
é ã®ãã£ããã£ãé»åã¡ãŒã«ã«ãã確èªãããã¯ç¢ºå®ã«ã¹ãã ã«ãªãã1æ¥åŸã«ã®ã¿ã«ãªããŸãã æ°ãããã°ã€ã³ãšãã¹ã¯ãŒãã®ãã¢ãå¿ãããã³ã«ããã¹ãŠã®ãµã€ãã«åããã®ãå
¥åããããšã¯å®å
šã§ã¯ãããŸããã äžéšã®å Žæã§ã¯ããqwertyïŒqwertyãããloginïŒpasswordãã®ãããªãã¢ãããŒã«ããã¯ãããŸãããæ²ããããªãã©ãã§ããããŸããã ç²ããã ãç»é²ãŠãŒã¶ãŒã ãã****ã§ããããšããç¢æãèŠãåæ°ãæ°ããŸãããåã«ãã®ãµã€ãã«äºåºŠãšã¢ã¯ã»ã¹ããªãããã«ã¿ããæ²ããŠéããŸããã ãªãœãŒã¹ç®¡çè
èªèº«ã¯ãããç解ããŠããŸãããïŒ
ããããOAuthãã¯ãããžãŒã¯ãã§ã«6幎åã§ãããã€ã³ã¿ãŒãããèŠèŽè
ã®90ïŒ
ãOAuthããµããŒããããªãœãŒã¹ã®å°ãªããšã1ã€ã«ã¢ã«ãŠã³ããæã£ãŠããŸãã ã§ã¯ããªãããã°ã€ã³ããã¿ã³ããã¹ãŠã®ãªãœãŒã¹ã§å©çšã§ããªãã®ã§ããïŒ ç§ã®ãµã€ãã«èª¿æ»ãã€ã³ã¹ããŒã«ããŸãã
ãããã å°ãæ祚ããŸããïŒãã¹ãŠã®ãŠãŒã¶ãŒãç¬èªã®ç»é²ãµã€ããæã£ãŠããããã§ã¯ãããŸããïŒããæ¿èªã«OAuthã䜿çšãããµã€ããå¢ããããšãæåŸ
ããŠããã®èšäºãæžãã¢ã€ãã¢ãåŸãã®ã«ååã§ãã ãªããªãïŒ
- ããã¯è€éãªæè¡ã§ã¯ãããŸããã èšäºãæåŸãŸã§èªãåãèŠã€ãã人ããOAuthã1ã2æ¥ã§ç¬ç«ããŠãµã€ãã«ãã蟌ãããšãã§ããããã«ãªãããšãé¡ã£ãŠããŸãã
- OAuthã¯HTTPã«åºã¥ããŠããŸãã ã»ãšãã©ã®ãµãŒãã¹ãããã€ããŒã¯ãããžã¿ã«çœ²åããå¿
èŠãããŸãããã€ãŸããGETããã³POSTãªã¯ãšã¹ããäœæããå®éã®æ©èœã¯å¥ãšããŠãäœãå¿
èŠãããŸããã ç¹å¥ãªã©ã€ãã©ãªãªãã
- 圌ãã¯ããªãã«ç»é²ããŸãïŒ å¥ã®ãµã€ãã§ãŠãŒã¶ãŒåã䜿çšããã ãã§ãã ãµãŒãã¹ãããã€ããŒã¯ããµã€ãã§å¿
èŠãªç¹å®ã®ãŠãŒã¶ãŒç¹æ§ãæäŸããŠããŸãããïŒ ãããã£ãŠãæåã®èšªåãšãã¹ãŠã®ããžãã¹ã§ãã®ç¹æ§ãèŠæ±ããŠãã ããã ãã以å€ã®å ŽåãOAuthãä»ããŠãã°ã€ã³ãããŠãŒã¶ãŒã¯ãéåžžã®æ¹æ³ã§ãã°ã€ã³ãããŠãŒã¶ãŒãšå€ãããŸããã
- OAuthãããã³ã«ãšãã®æ©èœã詳现ã«èª¬æããããšãç®çãšããŠããŸããã§ããã ããã¯ãããšãã°hereããã³hereã®ããã«ããã§ã«ç¹°ãè¿ãèšè¿°ãããŠããŸã ã ç¹å®ã®èšèªã«çžãããããšãªããæãäžè¬çãªRunetãœãŒã·ã£ã«ãããã¯ãŒã¯ã§ã®OAuthã®å®çšçãªå®è£
ã®äŸãæããããšæããŸãã
- ããŠãOAuthãå¿
èŠãšããªã7ïŒ
ã«ã€ããŠã¯-ãã®æçš¿ãèªãã§ãã100人ã®ç®¡çè
ã®ãã¡93人ãèªåã®ãµã€ãã«OAuthãå®è£
ããŠããã°ãç§ã¯ãã£ãšå¹žãã«ãªããŸã:)
ãªãOpenIDã§ã¯ãªãOAuthãªã®ã§ããïŒ
OpenIDã¯ã宣èšãããç®çã«ã¯å®è³ªçã«åœ¹ã«ç«ããªãããã§ãã ããã¯çŽç²ã«ç§ã®æèŠã§ããã空ãã¹ããŒã¹ã«äŸåããŠããŸããã
ãŸããOpenIDã¯äž»ã«ãªã¿ã¯ã«ãã£ãŠäœ¿çšãããŸãããªã¿ã¯ã®ã€ã³ã¿ãŒãããäžã®å²åã¯ããµã€ããåæ§ç¯ããã»ã©é«ããããŸããïŒãã¡ãããããã€ãã®äŸå€ã¯ãããŸããïŒ:) OpenIDã¢ã«ãŠã³ããååŸããã«ã¯ãååŸããå¿
èŠãããããã§ãã OpenIDãµãŒããŒã«ç§»åããããã€ãã®ã¢ã¯ã·ã§ã³ãå®è¡ããŠãç¹å®ã®ãããªããããã«ããæåã»ãããååŸããŸãã ïŒåçŽãªãŠãŒã¶ãŒã®å ŽåïŒè€éãã«ããããããã䜿ãæ
£ããçµµæåã衚瀺ããããå¿ããã«å
¥åããŠãã ãã
ã ããŠããããè¡ãã«ãžã¥ã¢ã«ãŠãŒã¶ãŒã¯äœã§ããããã OAuthã䜿çšãããšããã¹ãŠãã¯ããã«ç°¡åã«ãªããŸãããVKontakteçµç±ã§ãã°ã€ã³ããã¿ã³ã衚瀺ãããã¯ãªãã¯ããã ãã§ãç»é²æžã¿ãŠãŒã¶ãŒã®æš©éã§æ¢ã«ãµã€ãã«ã¢ã¯ã»ã¹ã§ããŸãã ããã£ãšã·ã³ãã«ã«ããšã¯ã©ã·ãã¯ã¯èšããŸãããããããŠäººã
ã¯ããªãã®ããã«æã䌞ã°ãã§ããããã 圌ãæ°Žãã®ãã蟌ãã ãšãã
第äºã«ãOAuthæ©èœã¯èªèšŒãšæ¿èªã«éå®ããããã®ã§ã¯ãããŸããã æ¿èªããã»ã¹äžã«ããŒã¯ã³ãåãåããšããœãŒã·ã£ã«ã¡ãã£ã¢æ©èœããªãœãŒã¹ã«ããã«çµ±åããããã«äœ¿çšã§ããŸã-æçš¿ã®èªã¿åã/æžã蟌ã¿ãå人ããŠã©ãŒã«ãžã®ã¢ã¯ã»ã¹ãªã©ã
第äžã«ãOpenIDã¯ã¹ãããŒãããã«ãŒã«ãã£ãŠç©æ¥µçã«äœ¿çšãããŠããŸãã å€ãã®å ŽåããªãœãŒã¹ãžã®OpenIDèªèšŒã®å®è£
ã¯ãæ¢ç¥ã®è匱æ§ã«ç¹å¥ãªæ³šæãæãããšãªããOpenIDãããã€ããŒã®ãããã³ã«ã®èª¬æã«ãã£ãŠããŸãã¯æªç¥ã®èª°ããäœæããã©ã€ãã©ãªã®å©ããåããŠã®ã¿è¡ãããŸãã ããšãã°ãå€ãã®ãµã€ãã¯OpenIDå
¥åããã®ãã£ããã£å
¥åãå¿
èŠãšããŸããã ãŸããæ»æè
ãOpenIDãµãŒããŒãååŸããã®ã劚ãããã®ã¯ãããŸãããOpenIDãµãŒããŒã¯ããã¹ãŠã®èå¥åã確èªããèªåçã«çæãããèå¥åã䜿çšããŠä¿¡é Œã§ãããµã€ããã¹ãã ãå§ããŸãã ããã«ãOpenIDèªèšŒã¯ãæ¬è³ªçã«ãã¯ã©ã€ã¢ã³ãã«ä¿èšŒãäžãããã®ã§ã¯ãããŸããã èŠæ±ããããŠãŒã¶ãŒãOpenIDãµãŒããŒã®1ã€ã«å®éã«ç»é²ãããŠããããšã確èªããã ãã§ã-ããã ãã§ãã ãŠãŒã¶ãŒã«é¢ããè¿œå æ
å ±ïŒé»åã¡ãŒã«ãååã幎霢ïŒãååŸããã¡ã«ããºã ã¯äœ¿çšå¯èœã§ããããµããŒããããŠãããã®ã¯ã»ãšãã©ãããŸããã ãã¡ãããOpenIDã®ã¢ã€ãã¢ã«éåããŠãèå¥åãåæããç¹å®ã®OpenIDãããã€ããŒïŒããšãã°ãåããœãŒã·ã£ã«ãããã¯ãŒã¯ïŒã®ã¿ãä¿¡é Œããããšãã§ããŸãã ãããããããã®ã»ãšãã©ãã¹ãŠãïŒLJãé€ããOpenIDã«ãã£ãŠãŠãŒã¶ãŒã«ã€ããŠã¯äœãèªããªãïŒOAuthããµããŒãããŠããå Žåãããã¯çã«ããªã£ãŠããŸãã ããã§ããã¹ãŠã®ãµã€ãããOpenIDãµããŒããåé€ããŸããã
ãã°ã€ã³ãŠã£ãžã§ããã§ã¯ãªãOAuthã䜿çšãããã®ã¯ãªãã§ããïŒ
åé¡ãããŸããã ãŠã£ãžã§ããã®æ©èœãèšèšãããã³ã»ãã¥ãªãã£ã¬ãã«ã«æºè¶³ããŠããå Žå-å®éã«ã³ãŒãã«çµã¿èŸŒãæ¹ãã¯ããã«ç°¡åã§ã-ããã«èªãããšã¯ã§ããŸããã
ã©ã®ããã«æ©èœããŸããïŒ
ãã¹ãŠã®è©³çŽ°ã«èå³ãããå Žåã¯ãäžèšã®ãªã³ã¯ãåç
§ããŠãã ããã äžèšã§èšãã°ïŒ
- ãµãŒãã¹ãããã€ããŒXXXã«ã¢ã¯ã»ã¹ããŠããµã€ããç»é²ããã¯ã©ã€ã¢ã³ãã³ãŒããšã·ãŒã¯ã¬ããã³ãŒããååŸããŸãã
- ãµã€ãã®ãã¿ã³ãXXXãããã°ã€ã³ããã¯ãªãã¯ãããšãXXXãµãŒããŒãšãªã¯ãšã¹ãã亀æãããŠãŒã¶ãŒãXXXã«ãªãã€ã¬ã¯ãããŠãã¹ã¯ãŒããå
¥åãããã°ã€ã³ããŠWebãµã€ããžã®ããŒã¿è»¢éã確èªããXXXãµãŒããŒããè¿œå ã®ãŠãŒã¶ãŒæ
å ±ããªã¯ãšã¹ãã§ããããŒã¯ã³ãåãåããŸãã 詳现ã¯ããµãŒãã¹ãããã€ããŒã§ã®OAuthã®å®è£
ïŒãµããŒããããŠãããããã³ã«ããŒãžã§ã³ããµããŒããããŠããã¹ããªãŒã ãªã©ïŒã«äŸåããŸãã
- åä¿¡ããããŒã¯ã³ã䜿çšããŠãååãé»åã¡ãŒã«ãç幎ææ¥ãã¢ãã¿ãŒãããã³ç»é²æã«éåžžå¿
èŠãªãã®ä»ã®æ
å ±ãXXXãµãŒããŒããååŸãããŸãã ãã®åŸãæšæºé¢æ°ãåŒã³åºããŠæ°ãããŠãŒã¶ãŒãè¿œå ã§ããŸãã
OAuthã©ã€ãã©ãªã䜿çšããŠãã³ãŒãã¹ããããã§ã¯ãªãçã®HTTPã䜿çšããçç±
ç§ã¯æ³šæã«èŠãããããŠããã®ã§ããã®éåžžã«çã®HTTPã1ã€ãŸãã¯å¥ã®ã©ã€ãã©ãªã®äœ¿çšã瀺ãã³ãŒãã®æçãããã°ãã°åŒãåºããŸããã åãµãŒããŒã®ç¹å®ã®OAuthå®è£
ã«ã¯ç¬èªã®åŸ®åŠãªç¹ãããããã®åã«æãæè»ãªã©ã€ãã©ãªã§ãä¿åã§ããŸãã ããã«ãå€ãã®ãŠã§ãèšèªãã©ã€ãã©ãªããããŸã-ããã«ããã¹ãŠã®äŸãäžããããšã¯åã«éçŸå®çã§ãã ãŸããä»»æã®ã©ã€ãã©ãªã䜿çšããã«ã¯ãçã®HTTPïŒãã¬ã€ã³ä»ãïŒã§ååã§ãã å察ã¯èšããŸããã
å®çšçãªå®è£
ã¬ã€ãã©ã€ã³
ãã¡ããããŸã第äžã«ããœãŒã·ã£ã«ãããã¯ãŒã¯ã«ç»é²ããã¢ã«ãŠã³ããã¢ã¯ãã£ãã«ããå¿
èŠããããŸãã æéããããŠãã ããã äžéšã®ãµãŒããŒã¯ãæ°ããç»é²ãããOAuthã¯ã©ã€ã¢ã³ãããã®èŠæ±ãããã«æ£ããåŠçããŸããã ããã§ã¯ãæåããã¹ã¬ããã®ã¿ããã€ã³ãããŸãããããšã©ãŒåŠçãå¿ããŠã䟡å€ã¯ãããŸããã ãŸããã»ãã¥ãªãã£ã®åŽé¢ã«ãã»ãšãã©æ³šæãæããŸããã§ãã-ããã¯å¥ã®èšäºã®ãããã¯ã§ãã å°ãªããšããåãŠãŒã¶ãŒã®ã³ãŒã«ããã¯URLã«äžæã®ãã©ã¡ãŒã¿ãŒãæž¡ãããšãã§ããå Žåã¯ãã€ã§ãããããè¡ã䟡å€ããããŸãïŒã¡ã€ã³ã³ãŒã«ããã¯ã¢ãã¬ã¹ã¯å€æŽããããã©ã¡ãŒã¿ãŒã®ã¿ãå€æŽããå¿
èŠããããŸãã mod_rewriteïŒã䜿çšããå¿
èŠããããŸãããŸããstateãã©ã¡ãŒã¿ãŒã䜿çšããŠãè¿œå ã®ããŒã¿ãã³ãŒã«ããã¯ã¹ã¯ãªããïŒãã®ãã©ã¡ãŒã¿ãŒããµããŒããããŠããå ŽåïŒã«è»¢éããå¿
èŠããããŸãã ãšããããããããã¹ãŠãæ®ããŸããã
VKontakte
1.
ããã«æ¥ãŠ
ãã ãã ã ã¿ã€ã-ããŠã§ããµã€ããã åºæ¬ãã¡ã€ã³ãšWebãµã€ãã®ã¢ãã¬ã¹ãå
¥åããŸãã èšå®ããŒãžã§ãclient_idïŒã¢ããªã±ãŒã·ã§ã³IDïŒãšsecret_keyïŒã»ãã¥ã¢ããŒïŒãååŸããŸãã
2.次ã®ãããªãã¿ã³ãã³ãŒãã«æ¿å
¥ããŸã
<a href="http://oauth.vk.com/authorize?client_id={client_id}&redirect_uri=mysite.com/vklogin&response_type=code" title=" "> </a>
response_type=code, token? response_type=token. vklogin? , , .
3. vklogin?
3.1. vklogin get- ( ) .
http://mysite.com/vklogin?code=7a6fa4dff77a228eeda56603b8f53806c883f011c40b72630bb50df056f6479e52a
http://mysite.com/vklogin?error=invalid_request&error_description=Invalid+display+parameter
, code,
3.2. https- (
POST, GET. , ) :
GET https://oauth.vk.com/access_token?client_id={client_id}&client_secret={secret_key}& code=7a6fa4dff77a228eeda56603b8f53806c883f011c40b72630bb50df056f6479e52a//
3.3. . , 200 OK .
JSON, access_token user_id. ( ) GET â users.get API :
GET https://api.vk.com/method/users.get?uids={user_id}&fields=uid,first_name,last_name,nickname,screen_name,sex,bdate,city,country,timezone,photo&access_token={access_token}
3.4. ( ) - JSON . . â utf8, â , .
, , . API .1.
.
OAuth . -. , , . , . «», ...
2. , , .
. «» , client_id(Application ID), public_key( ) secret_key( )
3. :
<a href="http://www.odnoklassniki.ru/oauth/authorize?client_id={client_id}&response_type=code&redirect_uri=http://mysite.com/oklogin" title=""> </a>
4. oklogin
3.1. code.
3.2.
POST :
http://api.odnoklassniki.ru/oauth/token.do
:
code={code}&redirect_uri=http://mysite.com/oklogin&grant_type=authorization_code&client_id={client_id}&client_secret={secret_key}
3.3.
JSON , access_token. GET-:
GET http://api.odnoklassniki.ru/fb.do?method=users.getCurrentUser&access_token={access_token}&application_key={public_key}&sig={sign}
sign â md5-
sign=hex_md5('application_key={public_key}method=users.getCurrentUser'+hex_md5({access_token}+{secret_key}))
-, .
3.4. JSON- , , , . â utf8;
users.getCurrentUser . API . , , .Facebook
1.
« ». App Domains () (). «Website with Facebook Login» url . client_id (App ID) secret_key (App Secret).
«Auth Dialog» «Authenticated Referrals» «code» «Auth Token Parameter».
2. :
https://www.facebook.com/dialog/oauth?client_id={client_id}&redirect_uri=mysite.com/fblogin&response_type=code
3.fblogin.
3.1. code.
3.2.
GETGET https://graph.facebook.com/oauth/access_token?client_id={client_id}&redirect_uri=http://mysite.com/fblogin&client_secret={client_secret}&code={code}
3.3.
(param1=value1¶m2=value2). access_token, GET-:
GET https://graph.facebook.com/me?access_token={access_token}
3.4.
JSON- , , , .
â NFC ( \u0410\u0401\u0419)
API ( ) .Twitter
1.
. , , -.
«Create my access token».
, . . ??? twitter - OAuth-. , ( Net::OAuth ) .1. OAuth 1.0 . « Twitter» ,
POST-https://api.twitter.com/oauth/request_token
:
Authorization:OAuth oauth_callback=«http%3A%2F%2Fmysite.com%2Ftwlogin», oauth_consumer_key="{consumer_key}", oauth_nonce="{nonce}", oauth_signature_method=«HMAC-SHA1», oauth_timestamp="{time}", oauth_signature="{sign}", oauth_version=«1.0»
oauth_callback â escape-uri - ;
consumer_key ;
nonce â base64 , , , 32, , ;
time â unix- ( , , «» , « »);
sign â HMAC-SHA1 .
nonce â .1.1. . , escape-, '&'. :
{_}&{escape-uri }&{escape- }
, escape-
. , ,
:
str='POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&oauth_callback%3D{http%253A%252F%252Fmysite.com%252Ftwlogin}%26oauth_consumer_key%3D{consumer_key}%26oauth_nonce%3D{random base64 srting}%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D{time}%26oauth_version%3D1.0'
1.2. , hmac_sha1 (, , ) 64. - :
str1=hmac_sha1(str,Consumer_secret+'&'+OAuth_token_secret,64).
OAuth token secret- , , Consumer secret '&'. ( ) base_64 , escape-. . .
2. ,
oauth_token=XXXXX.
https://api.twitter.com/oauth/authenticate?oauth_token=XXXXX
3. twlogin, :
3.1. oauth_token oauth_verifier ( )
3.2. POST-
https://api.twitter.com/oauth/access_token
Authorization:OAuth oauth_consumer_key="{consumer_key}", oauth_nonce="{random base64 string}", oauth_signature_method=«HMAC-SHA1», oauth_timestamp="{time}", oauth_signature="{sign}", oauth_token="{oauth_token}", oauth_version=«1.0»'
,
:
oauth_verifier={oauth_verifier}
oauth_token oauth_verifier , , sign
str='POST&https%3A%2F%2Fapi.twitter.com%2Foauth%2Faccess_token&oauth_consumer_key%3D{consumer_key}%26oauth_nonce%3D{random base64 string}%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D{time}%26oauth_token%3D{oauth_token}%26oauth_verifier%3D{oauth_verifier}%26oauth_version%3D1.0';
3.3. , . GET-
GET https://api.twitter.com/1/users/lookup.json?user_id={user_id}
Authorization:OAuth oauth_consumer_key="{consumer_key}", oauth_nonce="{random base64 string}", oauth_signature_method=«HMAC-SHA1», oauth_timestamp="{time}", oauth_signature="{sign}", oauth_token="{oauth_token}", oauth_version=«1.0»'
user_id oauth_token ,
str='GET&https%3A%2F%2Fapi.twitter.com%2F1%2Flookup.json&oauth_consumer_key%3D{consumer_key}%26oauth_nonce%3D{random base64 string}%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D{time}%26oauth_token%3D{oauth_token}%26oauth_version%3D1.0%26user_id%3D{user_id}'
, , oauth_token_secret:
str1=hmac_sha1(str,Consumer_secret+'&'+OAuth_token_secret,64)
3.4.
JSON- , , .
API .Mail.ru ()
1.
. , receiver.html, . receiver.html â , JS API, , , , receiver.html , . client_id (ID) secret_key ( ).
2. :
<a href="https://connect.mail.ru/oauth/authorize?client_id={client_id}&response_type=code&redirect_uri=http%3A%2F%2Fmysite.com%2Fmmlogin"> MailRu</a>
3. mmlogin
3.1. code.
3.2.
POST :
https://connect.mail.ru/oauth/token
:
client_id={client_id}&client_secret={secret_key}&grant_type=authorization_code&code={code}&redirect_uri=http://mysite.com/mmlogin
3.3.
JSON , access_token. GET-:
GET http://www.appsmail.ru/platform/api?method=users.getInfo&secure=1&app_id={client_id}&session_key={access_token}&sig={sign}
sign â md5-
sign=hex_md5('app_id={client_id}method=users.getInfosecure=1session_key={access_token}{secret_key}')
hex string.
3.4. JSON- , , , . â utf8;
API ( ) .1.
. .. .
client_id(Id ) secret_key( ).
2. :
<a href="https://oauth.yandex.ru/authorize?response_type=code&client_id={client_id}" title=""> </a>
3. yalogin
3.1. code.
3.2.
POST :
https://oauth.yandex.ru/token
:
grant_type=authorization_code&code={code}&client_id={client_id}&client_secret={secret_key}
3.3.
JSON , access_token. GET-:
GET https://login.yandex.ru/info?format=json&oauth_token={access_token}
3.4. JSON- , , email, . (, . . . â c, â « » .) â NFC-. , json- . , ,
email : xxx@ttt.com
. , RFC JSON , â - .
API yandex.login .Google
1.
. . API access «Create an OAuth2 client ID».
client_id(Client ID) secret_key(Client Secret).
2. :
<a href="https://accounts.google.com/o/oauth2/auth?redirect_uri=http%3A%2F%2Fmysite.com%2Fgglogin&response_type=code&client_id={client_id}&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile" title=" Google"> Google</a>
3. gglogin
3.1. code.
3.2.
POST :
https://accounts.google.com/o/oauth2/token
:
code={code}&client_id={client_id}&client_secret={secret_key}&redirect_uri=http://mysite.com/gglogin&grant_type=authorization_code
Content-type:application/x-www-form-urlencoded
3.3.
JSON , access_token. GET-:
GET https://www.googleapis.com/oauth2/v1/userinfo?access_token={access_token}
3.4. JSON- .
API - .. , .
, , OAuth. , , .
perl, , OAuth â . â .