本文介绍了使用OmniAuth可以获得Gmail oauth或xauth标记吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从GMail获得oauth或xauth标记,以便与一起使用。我正在考虑使用,但它似乎还不支持GMail,这意味着OmniAuth的股票是不可能。那是对的吗?我错过了什么?

解决方案

Omniauth支持OAuth和OAuth2,您可以验证Google帐户。



以下是您可以通过omniauth使用的所有策略:



以下是两个Google OAuth宝石:



  • b

  • $ b

    第一个宝石:



    将中间件添加到config / initializers / omniauth.rb中的Rails应用程序中:

      Rails.application.config.middleware.use OmniAuth :: Builder do 
    提供r:google,CONSUMER_KEY,CONSUMER_SECRET
    #加上您想要支持的任何其他策略
    结束

    外,设定主要 omniauth gem


    I want to get oauth or xauth tokens from GMail to use with gmail-oauth. I'm thinking of using OmniAuth but it seems not to support GMail yet, which means that with stock OmniAuth is impossible. Is that correct? Am I missing something?

    解决方案

    Omniauth has support for both OAuth and OAuth2, which will both allow you to authenticate a google account.

    Here are all of the strategies you can use via omniauth:https://github.com/intridea/omniauth/wiki/List-of-Strategies

    Here are the two google OAuth gems:

    As per the documentation of the first gem:

    Add the middleware to a Rails app in config/initializers/omniauth.rb:

    Rails.application.config.middleware.use OmniAuth::Builder do
      provider :google, CONSUMER_KEY, CONSUMER_SECRET
      # plus any other strategies you would like to support
    end
    

    This is done in addition to setting up the main omniauth gem.

    这篇关于使用OmniAuth可以获得Gmail oauth或xauth标记吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 16:48