google_oauth2_concern.rb 587 B

1234567891011121314151617181920212223242526272829303132
  1. module GoogleOauth2Concern
  2. extend ActiveSupport::Concern
  3. included do
  4. include Oauthable
  5. valid_oauth_providers :google
  6. end
  7. private
  8. def google_oauth2_client_id
  9. (config = Devise.omniauth_configs[:google]) && config.strategy.client_id
  10. end
  11. def google_oauth2_client_secret
  12. (config = Devise.omniauth_configs[:google]) && config.strategy.client_secret
  13. end
  14. def google_oauth2_email
  15. if service
  16. service.options[:email]
  17. end
  18. end
  19. def google_oauth2_access_token
  20. if service
  21. service.prepare_request
  22. service.token
  23. end
  24. end
  25. end