Weibo oauth
This commit is contained in:
parent
516baa4531
commit
337eef2ee5
2 changed files with 2 additions and 3 deletions
|
@ -10,7 +10,6 @@ github.com/go-sql-driver/mysql =
|
||||||
github.com/lib/pq =
|
github.com/lib/pq =
|
||||||
github.com/qiniu/log =
|
github.com/qiniu/log =
|
||||||
github.com/robfig/cron =
|
github.com/robfig/cron =
|
||||||
code.google.com/p/goauth2 =
|
|
||||||
github.com/Unknwon/com =
|
github.com/Unknwon/com =
|
||||||
github.com/Unknwon/cae =
|
github.com/Unknwon/cae =
|
||||||
github.com/Unknwon/goconfig =
|
github.com/Unknwon/goconfig =
|
||||||
|
@ -20,6 +19,7 @@ github.com/gogits/git =
|
||||||
github.com/gogits/gfm =
|
github.com/gogits/gfm =
|
||||||
github.com/gogits/cache =
|
github.com/gogits/cache =
|
||||||
github.com/gogits/session =
|
github.com/gogits/session =
|
||||||
|
github.com/gogits/oauth2 =
|
||||||
|
|
||||||
[res]
|
[res]
|
||||||
include = templates|public|conf
|
include = templates|public|conf
|
||||||
|
|
|
@ -371,7 +371,6 @@ func (s *SocialWeibo) SetRedirectUrl(url string) {
|
||||||
func (s *SocialWeibo) UserInfo(token *oauth.Token, _ *url.URL) (*BasicUserInfo, error) {
|
func (s *SocialWeibo) UserInfo(token *oauth.Token, _ *url.URL) (*BasicUserInfo, error) {
|
||||||
transport := &oauth.Transport{Token: token}
|
transport := &oauth.Transport{Token: token}
|
||||||
var data struct {
|
var data struct {
|
||||||
Id int64 `json:"id"`
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
var err error
|
var err error
|
||||||
|
@ -390,7 +389,7 @@ func (s *SocialWeibo) UserInfo(token *oauth.Token, _ *url.URL) (*BasicUserInfo,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &BasicUserInfo{
|
return &BasicUserInfo{
|
||||||
Identity: base.StrTo(data.Id).String(),
|
Identity: token.Extra["id_token"],
|
||||||
Name: data.Name,
|
Name: data.Name,
|
||||||
}, nil
|
}, nil
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
Reference in a new issue