:omniauthable
argument from your models. omniauth_providers: [:instagram]
ArgumentError: Mapping omniauth_callbacks on a resource that is not omniauthable
devise_for :shoppers, controllers: {omniauth_callbacks: "shoppers/omniauth_callbacks"}
devise_for :shoppers
shopper_omniauth_authorize GET|POST /shoppers/auth/:provider(.:format) shoppers/omniauth_callbacks#passthru {:provider=>/instagram/}
shopper_omniauth_callback GET|POST /shoppers/auth/:action/callback(.:format) shoppers/omniauth_callbacks#(?-mix:instagram)
The instructions demonstrate a way to recreate the latter of the two, to some extent. I add this to my routes.rb file:
get "/auth/:action/callback", to: "shoppers/omniauth_callbacks", constraints: {action: /instagram/}
which gives me the route:
GET /auth/:action/callback(.:format) shoppers/omniauth_callbacks#(?-mix:instagram)
But the former of those two routes doesn't exist, so now I get the error:
When I click on 'Authorize with Instagram'.
How do I get all of this to work?
Thanks
shopper_omniauth_authorize GET|POST /shoppers/auth/:provider(.:format) shoppers/omniauth_callbacks#passthru {:provider=>/instagram/}
/shoppers/auth/instagram
but on your Rails app you defined your route as /auth/:action/callback
, which is the same as /auth/instagram/callback.http://localhost:3000/auth/instagram/callback
. match "shoppers/auth/:action/callback" => "shoppers/omniauth_callbacks", constraints: {action: /instagram/}, via: [:get, :post]
devise_for :shoppers, controllers: {omniauth_callbacks: "shoppers/omniauth_callbacks"}
passthru
action./auth
to the correct OAuth URLs. So you don't actually have to define those routes./auth/instagram
instead of /shoppers/auth/instagram
.match "/auth/:action/callback" => "shoppers/omniauth_callbacks", constraints: {action: /instagram/}, via: [:get, :post]