SocialOauthApi
用于第三方登录后获取用户信息
提供给前后端分离的框架使用
只接受前端sdk传回来的第三方 access_token 参数及其它必须参数
支持第三方列表如下:
Installation
Add this line to your application's Gemfile:
gem 'social_oauth_api', '~> 0.1.3'
And then execute:
$ bundle
Or install it yourself as:
$ gem install social_oauth_api
Usage
require 'social_oauth_api'
weibo_config = {
provider_type: 'sinaweibo',
access_token: 'xxxxxxxxx'
}
qq_config = {
provider_type: 'qqdenglu',
access_token: 'xxxxxxxx',
client_id: 'xxxxxxxx'
}
weixin_config = {
provider_type: 'weixin',
access_token: 'xxxxxxxxx',
openid: 'xxxxxxxx'
}
weibo = SocialOauthApi::User.new(weibo_config)
p weibo.id
p weibo.name
p weibo.image_url
p weibo.user_info
qq = SocialOauthApi::User.new(qq_config)
p qq.id
p qq.name
p qq.image_url
p qq.user_info
weixin = SocialOauthApi::User.new(weixin_config)
p weixin.id
p weixin.name
p weixin.image_url
p weixin.user_info
Contributing
- Fork it ( https://github.com/awesome-api/social_oauth_api/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request