Skip to content
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

Save profile image #23

Open
3 tasks
SimonLab opened this issue Apr 15, 2020 · 0 comments
Open
3 tasks

Save profile image #23

SimonLab opened this issue Apr 15, 2020 · 0 comments

Comments

@SimonLab
Copy link
Member

Google and Github Oauth2 allow us to get basic information about the user.
We are currently only saving in our Postgres person database the email of the user:

schema "people" do
field :email, :string
field :verified, :boolean, default: false
has_many :sessions, AuthMvp.People.Session
timestamps()
end

We want now to be able to save the profile image of the user.
With Google the image url is already returned via ElixirAuthGoogle package under the picture value:

{:ok, profile} = ElixirAuthGoogle.get_user_profile(token.access_token)

With Github the value to get will be saved under avatar_url

  • Update the schema to add an avatar string field
  • Add a new migration to create the avatar field in the database
  • Update the person changeset to cast the avatar value:
def changeset(person, attrs) do
    person
    |> cast(attrs, [:email, :verified])
    |> validate_required([:email, :verified])
  end
@SimonLab SimonLab added the T1h label Apr 15, 2020
@SimonLab SimonLab self-assigned this Apr 15, 2020
SimonLab added a commit that referenced this issue Apr 15, 2020
SimonLab added a commit that referenced this issue Apr 15, 2020
SimonLab added a commit that referenced this issue Apr 15, 2020
SimonLab added a commit that referenced this issue Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant