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 5 to 1

ostap

ostap

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

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.

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.

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?

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

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews