Import GitHub image as profile image when authenticating with GitHub

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

1 Like

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.

4 Likes

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.

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

2 Likes

Hello!
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:

7 Likes

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

3 Likes

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:

2 Likes

Implemented per

https://github.com/discourse/discourse/pull/5073

Cheers!

11 Likes

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

2 Likes

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