aiwaiwa

aiwaiwa

  1. If I’m only interested in the username (nickname) at github, is there a way to achieve that? Basically I’m not interested in emails, I just need to verify that I’m dealing with a few administrators via github auth.

This is my current config:

config :ueberauth, Ueberauth,
  providers: [
    github:
      {Ueberauth.Strategy.Github,
       [
         default_scope: "user:email",
         callback_path: "/auth/github/callback"
       ]}
  ]
  1. I also wonder if this callback_path could be somehow made relative to the current domain?

Showing Posts 1 to 5

linusdm

linusdm

I’m not sure what you’re asking regarding your first point. I’d advice to do some trial and error, and see what the minimal scope is you can get away with, no?

Regarding your second point: I’m not sure how you could do this with Ueberauth, because of the way it needs to be configured in one of your config scripts. But I suggest to take a look at Assent instead. IMO it’s much easier to configure Assent. I used to depend on Ueberauth for OAuth integration, but I switched because I found Assent to be easier to configure and understand. The downside is that it requires you to wire up your own controller (but that doesn’t require much glue code anyway). Assent itself has a very simple API, and can be used independently from Pow (I don’t use Pow, but I do use Assent together with the phx.gen.auth code).

I have a simple demo repo online (phx_gen_auth_meetes_assent) that shows how to integrate Assent. See this specific line to see how you’d configure Assent to have the correct callback path, using verified routes:
https://github.com/linusdm/phx_gen_auth_meets_assent/blob/main/lib/my_app_web/controllers/auth_controller.ex#L32

aiwaiwa

aiwaiwa OP

Thank you for you reply! So it’s unusual to try not to fish for a user’s email and simply verify him by a nickname?

aiwaiwa

aiwaiwa OP

Went ahead to report an issue/feature request. Issue · GitHub
Seeing this as a vital feature to simply authenticate a github user without email.

linusdm

linusdm

Although I do appreciate that you’re going for the minimal data of your logged in users, I’m not sure if that’s really a rabbit hole worth following. An email address is the identifier of your user. So if you don’t need that, then what do you need? A nickname can also be entered in an input field, without the whole OAuth dance. It won’t be unique anyway, and you won’t be guarding against identity-fraud or something, as anyone can choose any nickname they want. Are you sure you want OAuth integration at all?
I’m not even sure the consent dialog of Github will make the distinction when you omit the email address from the requested scope. If the users can’t even see the difference, then… meh :man_shrugging: Just don’t save the email address. It might be unfortunate that email addresses are being used for account identifiers, but that’s a given at this point.

I’ve recently learned from Chris McCord on slack that the livebeats sample app implements OAuth integration with Github from scratch. Look here for more inspiration: live_beats/lib/live_beats/github.ex at master · fly-apps/live_beats · GitHub (it’s being called from the OAuthCallbackController, which is very similar to how you’d use Ueberauth or Assent). It’s quite concise and elegant (but it does only github, no other IdP’s). It also fetches the email address, but you can strip that from the code, so it’s even more concise, if that’s your goal.

ostap

ostap

@aiwaiwa I suggest verifying by ID instead. Unlike an email address or a nickname, a provider-given user ID wouldn’t change.

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews