Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a redirect_uri function so that the redirect_uri is configurable #18

Closed
aef- opened this issue Mar 31, 2016 · 4 comments
Closed

Add a redirect_uri function so that the redirect_uri is configurable #18

aef- opened this issue Mar 31, 2016 · 4 comments

Comments

@aef-
Copy link

aef- commented Mar 31, 2016

Hi there! Currently I'm using only the callback functionality of ueberauth (specifically Facebook and Google). My client grabs the access code and then sends it to my API in order to retrieve the token. On dev I'm running my API and client on separate ports, so to support how most ueberauth's implement handle_callback by setting the redirect_uri as so: opts = [redirect_uri: callback_url(conn)], I need a reverse proxy.

Adding a a helper function redirect_uri that grabs either the uri from the config or callback_url for oauth implementations to use would be really helpful for scenarios like this.

What do you think?

@doomspork
Copy link
Member

@aef- PRs are welcome for new functionality 👍

@nicooga
Copy link
Contributor

nicooga commented Jun 5, 2016

I don't know wheter this is related, but I'm also working with a single page application and an elixir API.
I'm using https://github.com/sahat/satellizer to fire the popups on the single page, then POSTing with code to the API. The result is an ueberauth error redirect_uri_mismatch.

pry(6)> params
%{"clientId" => "...",
  "code" => "4/vLOSfRQi-OK6B...",
  "provider" => "google", "redirectUri" => "http://localhost:3333",
  "state" => "....."}
pry(7)> fails
%Ueberauth.Failure{errors: [%Ueberauth.Failure.Error{message: nil,
   message_key: "redirect_uri_mismatch"}], provider: :google,
 strategy: Ueberauth.Strategy.Google}

I'm not sure how to continue, I'm pretty sure I've configured well the allowed redirect uris on google console.

@nicooga
Copy link
Contributor

nicooga commented Jun 5, 2016

Indeed, made a fork to implement this functionality and that worked for me.

config :ueberauth, Ueberauth,
  providers: [
    google: {Ueberauth.Strategy.Google, [
      callback_methods: ["POST"],
      callback_path: "/api/auth/google/callback",
      callback_url: "http://localhost:3333" # Where my Brunch app is running
    ]}
  ]

Making a PR ASAP.

@doomspork
Copy link
Member

This has been merged into master. I'll release a new version later this evening, ideally with #28 included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants