Navigation Menu

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

Allow to add extra params to callback_url #45

Merged
merged 3 commits into from Jan 11, 2017

Conversation

radzserg
Copy link
Contributor

I added ability to specify :callback_params in settings for strategies

config :ueberauth, Ueberauth,
   providers: [
     facebook: { Ueberauth.Strategy.Facebook, [callback_params: ["type", "user_role"]]} 
]

then add this extra param to login/sign-up links


 auth_path(@conn, :request, "facebook", type: "sign-in")
 auth_path(@conn, :request, "twitter", user_role: "manager")

Tested on facebook twitter and VK strategies.

Copy link
Member

@doomspork doomspork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @radzserg 👍

assert Ueberauth.Strategy.Helpers.callback_url(conn) ==
"https://www.example.com/auth/provider/callback"
end

test "callback_url forwarded protocol" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to remove this test?

@@ -14,7 +14,8 @@ defmodule UeberauthTest do
end

test "simple callback phase" do
conn = conn(:get, "/auth/simple/callback") |> SpecRouter.call(@opts)
conn = conn(:get, "/auth/simple/callback")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind refactoring this bit? I need to setup Credo on the repos.

conn = :get
       |> conn("/auth/simple/callback")
       |> SpecRouter.call(@opts)
auth = conn.assigns.ueberauth_auth

@radzserg
Copy link
Contributor Author

@doomspork Done

@doomspork doomspork merged commit ea11906 into ueberauth:master Jan 11, 2017
@doomspork
Copy link
Member

Thank you @radzserg 👍

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

Successfully merging this pull request may close these issues.

None yet

2 participants