add missing step to get fb url under data

This commit is contained in:
Umputun
2018-02-14 02:40:31 -06:00
parent 7ca8e8e5e8
commit 99367076f4
+7 -5
View File
@@ -1,7 +1,6 @@
package auth
import (
"log"
"strings"
"golang.org/x/oauth2/facebook"
@@ -82,10 +81,13 @@ func NewFacebook(p Params) Provider {
// picture under picture[data[url]]
if p, ok := data["picture"]; ok {
if d, ok := p.(map[string]interface{}); ok {
log.Printf("%+v", d)
if picURL, ok := d["url"]; ok {
userInfo.Picture = picURL.(string)
if picMap, ok := p.(map[string]interface{}); ok {
if d, ok := picMap["data"]; ok {
if dataMap, ok := d.(map[string]interface{}); ok {
if picURL, ok := dataMap["url"]; ok {
userInfo.Picture = picURL.(string)
}
}
}
}
}