Create named routes for OmniAuth in Rails 3

前端 未结 3 1608
别跟我提以往
别跟我提以往 2021-02-05 22:04

After having watched Ryan\'s excellent Railcast Simple OmniAuth, I\'ve managed to implement authentication in my app.

Everything is working fine, but in my view I have l

3条回答
  •  清酒与你
    2021-02-05 22:50

    Add this to your routes.rb

    get "/auth/:provider", to: lambda{ |env| [404, {}, ["Not Found"]] }, as: :oauth

    Now you can use oauth_path url helper to generate urls.

    Eg. oauth_path(:facebook) # => /auth/facebook

提交回复
热议问题