差分

移動先: 案内検索

Tabetai

610 バイト追加, 2023年7月8日 (土) 09:59
DeviseとOmniauthでGoogle、Twitter、Facebook認証
$ rails g migration AddOmniauthToUsers provider:string uid:string
 
<nowiki># config/initializers/devise.rb
 
config.omniauth :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], scope: 'email', info_fields: 'email', callback_url: "#{ENV['HOST']}/users/auth/facebook/callback"
 
config.omniauth :twitter, ENV['TWITTER_API_KEY'], ENV['TWITTER_API_SECRET'], scope: 'email', oauth_callback: "#{ENV['HOST']}/users/auth/twitter/callback"
 
config.omniauth :google_oauth2, ENV['GOOGLE_CLIENT_ID'], ENV['GOOGLE_CLIENT_SECRET'], scope: 'email', redirect_uri: "#{ENV['HOST']}/users/auth/google_oauth2/callback"
 
OmniAuth.config.logger = Rails.logger if Rails.env.development?</nowiki>

案内メニュー