What is currently the correct way to use Omniauth with Google credentials?

Currently the best way to authorize users of a Rails application using Google credentials?

Google has made significant changes to its services over the last year or so. At the same time, information about Omniauth and Google is rather scarce from what I see. Therefore, I would like to know what people consider the best at the moment.

I am using Devise + Omniauth. I want users to be able to log in using their Google credentials (I already understand how to do this for other providers). But I also need an oauth token that will allow users to interact with their Google+ stream and other services (I know that the API is currently read-only, but I plan for the future).

So my specific questions are:

1) I saw a link to use open-id or omniauth-google-oauth2 gem. Are there significant differences between the two approaches and what is now considered “right”?

2) How are the walls of the Google ecosystem? For example, is it straightforward enough for a user to interact with their G + stream and their Picassa albums and their YouTube videos, etc. From my application? Or are these completely separate ecosystems? I ask about this because the information I saw seems to suggest that a particular service should be defined as the area when omniauth for google is initialized. But it is unclear how services are integrated after user authentication.

Thanks for any tips or tips that will help me deal with Google!

+3
source share
1 answer

gem - gmail. Twitter , , ... :

# Gemfile
gem 'omniauth-openid'

# Using pure omniauth
# omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :openid, :store => OpenID::Store::Filesystem.new('/tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
end

# Using devise
# devise.rb
Devise.setup do |config|
  config.omniauth :open_id, :store => OpenID::Store::Filesystem.new('/tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
end

! , , , , , , . , , ( ) . , , , . StackOverflow, .

, .

, , omniauth-google-oauth2 - . Google Cloud Console API .

, Google Oauth (, , ). , , (G + stream, youtube videos,..), , , , eh!

+3

All Articles