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
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
pragdave
How do I tell Hologram not to escape HTML when substituting into templates? {Textile.render(@product.long_description)} escapes the HTM...
New
rlipscombe
I’d like to create a file with 600 permissions (rw-------), but there’s a race condition if I create it and then change the permissions. ...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
rlipscombe
When I use Mix.install with a git dependency, using git@github.com:... how do I change the SSH identity used? I’ve got two Github accoun...
New
adr
Hello all. I have a question as to best practices for code organization when implementing a liveview with a lot of responsibilities. Sup...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews