sorliem

sorliem

Ueberauth for Apple Sign in?

Hello!

I am looking at implementing Apple Sign in soon and was looking for an out-of-the-box solution in the Elixir community, if there was one. But, since Apple Sign In is so new, I didn’t expect to see any libraries out there.

I however came across the Ueberauth project and was wondering if there were any plans to have Apple be one of the providers?

Thank you.

Most Liked

Schultzer

Schultzer

If you go with https://github.com/danschultzer/pow you get apple sign in out off the box with https://github.com/pow-auth/assent

danschultzer

danschultzer

Pow Core Team

You should call the callback method passing along the auth code:

config
|> Assent.Config.put(:session_params, %{})
|> Assent.Strategy.Apple.callback(%{"code" => apple_auth})
|> case do
  {:ok, %{user: _user, token: _token}} ->
    conn |> put_status(:ok) |> put_view(MyAppWeb.ErrorView) |> render(:"200")
  _ ->
    conn |> put_status(400) |> put_view(MyAppWeb.ErrorView) |> render(:"400") 
end

:session_params are required in Assent, but in this case it can just be an empty map as you don’t need to validate state.

Remember that the :redirect_uri in the config should match your app. If I remember correctly with Apple it just has to be nil or empty string, since there’s no redirect uri in the app:

config = [
  client_id: "REPLACE_WITH_SERVICES_ID",
  team_id: "REPLACE_WITH_TEAM_ID",
  private_key_id: "REPLACE_WITH_PRIVATE_KEY_ID",
  private_key_path: "/path/to/key.p8",
  redirect_uri: nil
]
sorliem

sorliem

Sorry, I should have had more information. Apple says they implemented the OpenID Connect standard, but from an article by Auth0 they say

Apple is using parts of the OAuth 2.0 and OpenID Connect (OIDC) standards.

So I guess another question would be does Ueberauth support OpenID connect flows? Or just the Oauth2 protocol.

I haven’t done much experimenting with the Apple Sign in API, and this question may have been a bit premature. Apologies for that.

EDIT: Apple sign in docs i’m looking at Sign in with Apple | Apple Developer Documentation

OvermindDL1

OvermindDL1

OpenID Connect is mostly just OAuth2 with some auto-finding and so forth. If you manually define the connections for OAuth2 then it generally works on OpenID Connect. So you could probably just take the oauth2 plugin and do that, or fork it and bake in Apple’s connections into it so it becomes fairly configurationless. :slight_smile:

sorliem

sorliem

Oh, cool. I’ll take a look at Pow, I have not heard of that before. Thanks @Schultzer and @OvermindDL1!

Where Next?

Popular in Questions Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Other popular topics Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement