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

How to get it working in 2024 #80

Open
initseis opened this issue Feb 28, 2024 · 3 comments
Open

How to get it working in 2024 #80

initseis opened this issue Feb 28, 2024 · 3 comments

Comments

@initseis
Copy link

I had to do Monkey Patching like this:

module OmniAuth
  module Strategies
    class LinkedIn < OmniAuth::Strategies::OAuth2
      uid do
        raw_info["sub"]
      end

      info do
        {
          :name => raw_info["given_name"],
          :family_name => raw_info["family_name"],
          :email => raw_info["email"],
          :image => raw_info["picture"]
        }
      end

      extra do
        {
          "info" => raw_info
        }
      end

      def profile_endpoint
        "/v2/userinfo"
      end
    end
  end
end

And the button this way:

<%= button_to "/auth/linkedin", data: { turbo: false }, class: "px-4 py-2 border flex gap-2 border-dark rounded-lg text-dark hover:shadow transition duration-150"  do %>
  <span class="size-6">
    <%= render "icons/linkedin" %>
  </span>
  <span><%= t("pages.sign_up.sign_up_with_linkedin") %></span>
<% end %>
@botularius
Copy link

+1

@hasghari
Copy link

There's a new gem to support the OpenID auth flow: https://github.com/jclusso/omniauth-linkedin-openid

@initseis
Copy link
Author

initseis commented Nov 6, 2024

There's a new gem to support the OpenID auth flow: https://github.com/jclusso/omniauth-linkedin-openid

It works like a charm!

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

No branches or pull requests

3 participants