aiwaiwa

aiwaiwa

Ueberauth: github nickname only; callback domain

  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?

Most Liked

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

Last Post!

ostap

ostap

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

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130579 1222
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31525 112
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New

We're in Beta

About us Mission Statement