-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retrieve image and gender from FB api call #21
base: master
Are you sure you want to change the base?
Conversation
src/multi_auth/providers/facebook.cr
Outdated
@@ -20,6 +20,8 @@ class MultiAuth::Provider::Facebook < MultiAuth::Provider | |||
user.last_name = fb_user.last_name | |||
user.location = fb_user.location | |||
user.description = fb_user.about | |||
user.image = fb_user.picture[:data][:url] | |||
user.gender = fb_user.gender if fb_user.gender |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO user.gender = fb_user.gender
should work, no needs for if
@@ -20,6 +20,8 @@ class MultiAuth::Provider::Facebook < MultiAuth::Provider | |||
user.last_name = fb_user.last_name | |||
user.location = fb_user.location | |||
user.description = fb_user.about | |||
user.image = fb_user.picture[:data][:url] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code will raise an exception if fb_user.picture is nil, right? could we avoid it?
src/multi_auth/providers/facebook.cr
Outdated
@@ -34,7 +36,9 @@ class MultiAuth::Provider::Facebook < MultiAuth::Provider | |||
property raw_json : String? | |||
property access_token : OAuth2::AccessToken? | |||
property picture_url : String? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let remove it, if it not used
FBUser.picture_url
is not filled by the FB api nor is it used. A minor modification was required to retrieve the picture and gender as well.