dwyl/elixir-auth-google

Does this work with barebones Elixir / no Phoenix?

开放

#123 创建于 2024年4月21日

 (2 条评论) (2 个反应) (0 位负责人)Elixir (46 个派生)github user discovery
help wantedquestiontechnicaluser-feedback

仓库指标

星标
 (290 个星标)
PR 合并指标
 (平均合并 5小时 39分钟) (30 天内合并 2 个 PR)

描述

I'm trying to use this in a project without Phoenix and, with the same exact credentials, it will work on the Phoenix project but not on the Elixir one. It keeps throwing the "invalid_client" and "The OAuth client was not found." error after I request the token. I am running the server and client separately.

Here's the code:

post "/" do
  conn = Plug.Conn.fetch_session(conn)

  code = Map.get(conn.body_params, "code", "")

  {:ok, token} =
    ElixirAuthGoogle.get_token(
      code,
      "#{Application.get_env(:root, :frontend_url)}"
    )
    |> IO.inspect()

  {:ok, profile} = ElixirAuthGoogle.get_user_profile(token.access_token) |> IO.inspect()

  ...
end

Am I doing something wrong? This is the only relevant code to the project, and it is throwing after ElixirAuthGoogle.get_token/2

贡献者指南