Devise: Omniauthable OPTIONS oauth/authorize RoutingError

Created on 18 Aug 2016  路  1Comment  路  Source: heartcombo/devise

I have a Oauth server _A_ running with doorkeeper (version 4.1.0) and a project, let's name it server _B_ using devise omniauthable (version 4.2.0) to connect through Oauth with server _A_.

The connection flow works pretty well except I have noticed during the authorize step that _B_ tries to request _A_ with OPTIONS "/oauth/authorize?client_id=4dc67780f513d62a............ giving me a RoutingError on server _A_.

Then _B_ requests _A_ with GET GET "/oauth/authorize?client_id=4dc67780f513d62a799ba8d245d and all the Oauth authentication works normally after.

The logs of my doorkeeper server _A_:

Started OPTIONS "/oauth/authorize?client_id=4dc67780f513d62a799.............
ActionController::RoutingError (No route matches [OPTIONS] "/oauth/authorize"):
  ...........

Started GET "/oauth/authorize?client_id=4dc67780f513d62a799ba8d245d9dcb212248..........
Processing by Doorkeeper::AuthorizationsController#new as HTML

How to avoid the first HTTP request with the verb OPTIONS ?

Most helpful comment

Hello,

You probably are using turbolinks. You will need to disable turbolinks on the omniauth link

<%= link_to 'CLICK ME', user_doorkeeper_omniauth_authorize_path, data: { turbolinks: false } %>

Hope it helps!

>All comments

Hello,

You probably are using turbolinks. You will need to disable turbolinks on the omniauth link

<%= link_to 'CLICK ME', user_doorkeeper_omniauth_authorize_path, data: { turbolinks: false } %>

Hope it helps!

Was this page helpful?
0 / 5 - 0 ratings