0

I am having a rails project in which my client's requirement is to login user with yahoo So, I need to integrate user authentication using yahoo.

I am badly stuck due to limited resources in order to achieve this so finally I came on SO.

Well, after struggling much this code give me some hope but it is very basic level of startup and I dont know where and what to do now.

Here is my some code part:

client = OAuth2::Client.new(oauth_consumer_key,oauth_consumer_secret, {
        access_token_path:   '/oauth/v2/get_token',
        authorize_path:      '/oauth/v2/request_auth',
        authorize_url:       'https://api.login.yahoo.com/oauth/v2/request_auth',
        request_token_path:  '/oauth/v2/get_request_token',
        site:                'https://api.login.yahoo.com'
    })
puts client.auth_code.authorize_url( redirect_uri: "http://lvh.me:3000")
code = gets.chomp
token = client.auth_code.get_token(code, redirect_uri: "http://lvh.me:3000")

1 Answers1

0

OK so there are like a million tutorials about how to use Devise with OmniAuth. There is a gem for omniauth yahoo. This is my favorite tutorial for it: https://www.digitalocean.com/community/tutorials/how-to-configure-devise-and-omniauth-for-your-rails-application.

I would just use the yahoo gem instead of the digital ocean one they suggest. Yahoo Gem: https://github.com/timbreitkreutz/omniauth-yahoo

Also refer to this SO question where he walks through an install with Facebook: How to use and configure omniauth with yahoo, google, facebook strategies in various environments?

Community
  • 1
  • 1
ChiefRockaChris
  • 643
  • 5
  • 21