Import GitHub image as profile image when authenticating with GitHub

(Quincy Larson) #1

User story: As a new user, when I authenticate with GitHub, my profile image should automatically become whatever my GitHub profile image is.

According to @codinghorror this is not currently on the roadmap. I am not 100% sure whether this should be a plugin or an option in available in Discourse. It sounds like a plugin would be the faster route, unless this is a feature that other admins would benefit from.

previous discussion on this topic

CC @michaelhenderson

Lock username to GitHub username when authenticating using GitHub
(Sam Saffron) #2

This can be in core if someone wants to add it, but the default should not be to override avatars, just populate if blank.

Site setting if anyone wants override behavior.

(Divyanshu Mehta) #3

Well yes. Even I think it is an desirable feature. Yesterday I signed in with Github and my profile picture didn’t get updated with my profile picture on Github.
The meta pages also lack this, I think it would be a good feature to see implemented.

(Sam Saffron) #4

There is a #pr-welcome tag on this, so … a pull request from the community is welcome.

(Ishaan Malhi) #5

It’s my first time contributing to Discourse. I’ve setup my dev environment and a test account.
Do you mind if I give this a shot? :smile:

(Sam Saffron) #6

Sure, go for it! :slight_smile: :heart:

(Ishaan Malhi) #7

Hello @sam

I am using #retrieve_avatar similar to the one used in facebook_authenticator.rb. However, I am getting a bug where the user params aren’t being put inside a :user_fields key when being processed by UserController#create, causing params.permit(:user_fields) to fail.

I don’t think my changes to the github_authenticator have caused this. :confused:

While debugging the issue, I also noticed that #strip is called on params[:email], which is an array causing the failure. This error fails silently and doesn’t show up in the logs.

Is it just me experiencing the issue?


Are you still working on this issue?
If not, I can continue to help to resolve this issue. :wink:


Implemented per


(Quincy Larson) #10

Awesome! This will save people a lot of time! Thanks!

(Erlend Sogge Heggen) #11

A post was split to a new topic: Import profile picture for GitHub OAuth

(Alan Tan) #12