2015年6月6日 星期六

weibo + omniauth

利用OAuth2协议将网站接入到新浪微博

http://hansay.com/2012/06/22/integrate-sina-weibo-with-oauth2/

Ruby on Rails中实现Omniauth第三方登录最终解决方案(豆瓣、QQ、微博第三方登录)

http://www.douban.com/note/411359006/



devise_omniauth_oauth2_tqq_douban_weibo.rb
https://gist.github.com/krongk/b3a9ab3750df04d621a0

OmniAuth Weibo OAuth2




https://gist.github.com/krongk/aedf1566ad6a8ffdba9f

微博登录
http://open.weibo.com/webmaster/deploy/weibologin?siteid=384898092


Devise - part 2 - Use Omniauthable module

http://chouandy.logdown.com/posts/245192-devise-part-2-use-omniauthable-module


example: IMportant

https://github.com/caiwenhn2008/rails4blog/blob/master/app/models/user.rb


def self.from_omniauth(auth)
where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
user.provider = auth.provider
user.uid = auth.uid
email = auth.info.email
user.email = email || user.uid.to_s + "@wilsonblog.com"
user.password = Devise.friendly_token[0,20]
end
end

沒有留言:

張貼留言