OmniAuthãæ£ããcallbackããã
å
æ¥ããTwitterã§ãã°ã¤ã³ã§ããBBSããã
Apache+(nginx+passenger)ã¨ããç°å¢ã«ãªãªã¼ã¹ããã®ã§ããã
ãã®èªè¨¼ã«å©ç¨ããã®ããOmniAuthãã§ãããã¾ã
https://github.com/intridea/omniauth
WEB+DB PRESSã®vol.64ã«ãè¨äºãããã¾ã(´・Ïï½¥)ã£
- ä½è : ææ¨æ³°å¹¸,æ¾éç´æ,æèé«,æ義å®,飯å¡ç´,é«æ©å¾ç¾©,徳永æä¹,Tehuï¼å¼µæºï¼,ä¸å³¶è¡,ãã«ãã¾
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2011/08/24
- ã¡ãã£ã¢: 大åæ¬
- è³¼å ¥: 17人 ã¯ãªãã¯: 714å
- ãã®ååãå«ãããã° (16件) ãè¦ã
Twitter/Facebook/OpenIDçã
ã®èªè¨¼ãã
åä¸ã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ã§å¯è½ã¨ããããã°ããããã®ãªã®ã§ããã
ããã«é¢ããè¨äºã¯å±±ã»ã©ããã®ã§ãã¡ããè¦ã¦ãããã¨ãã¦ã»ã»ã»
éçºç°å¢ã§ã¯ãã£ããåããã®ã§ãããåé¡ã¯æ¬çªç°å¢ã§ã
OmniAuthããTwitterã®èªè¨¼ãå¼ã¶ã¾ã§ã¯ããã®ã§ããã
TwitterããCallbackãããéã
ããã¯ã¨ã³ãã®ãã¼ãã¤ãã§å¼ã³åºããã¦ãã¾ãã®ã§ãΣ(ï¾Ðï¾)カï¾ï½°ï¾
ã¤ã¾ãããexample.com/hoge/auth/twitter/callbackããå¼ãã§ã»ããã®ã§ããã
ãexample.com:8888/hoge/auth/twitter/callbackãã«æ»ããã¨ãã¦ãã¾ãã
ã¢ã¯ã»ã¹ãã§ããªãã¨ããåé¡ãåºã¾ãã
ããããæåã«ä½ã£ãRails3.1çã®ãããã¿ã¤ãã§ã¯åé¡ãªãã£ãã®ãã
æ£å¼ã«ä½ãæ¿ããRails3.0çã ã¨ãã¼ããã¤ãã¦ãã¦ãã¾ãã®ã§ã
ãã¶ããä¸ã§å¼ãã§ããã¡ã½ããã®å®è£
ãå¤ãã£ãã®ã§ããããã©ãã»ã»ã»
ã©ã¡ãã«ããããããã¯ã¨ã³ãã®URLãã«æ»ãã®ã§ã¯ãªãã
ãããã³ãã®URLãã«æ»ã£ã¦ã»ããã®ã§ããã
ãã®ããæ¹ãããããªãã¦ããªãæ©ã¿ã¾ãã(´-Ï-) *1
çµæçã«ã¯こちらã«çãã
# in config/initializers/omniauth.rb OmniAuth.config.full_host = "http://example.com" # ããã³ãã®URL Rails.application.config.middleware.use OmniAuth::Builder do # Twitterèªè¨¼ provider :twitter, YOUR_KEY, YOUR_SECRET end
ããã§OmniAuthã§ä½¿ãURLãå¼·å¶ã§ãã¾ã(ï½ï½¥Ï・´) ï½
å
ã®è¨äºãèªãã¨ãProcã渡ãã¦ãã®çµæã使ããã¨ãã§ããããã§ã
ã§ãä½ã渡ãããªãã¨èªèº«ã®URLããçæããã»ã»ã»ã¨
*1:ã©ã®è¨äºããéçºç°å¢ã§åããã¨ãããã¾ã§ããæ¸ãã¦ãªãã¦ãæ¬çªã§ãã®åé¡ã«ã©ã対å¦ããã®ãæ¸ããè¨äºãè¦ã¤ãããªãã£ãã¨ããã»ã»ã»