Kamilski81
Kamilski81

Reputation: 15117

how does omniauth intercept /auth/facebook in rails?

I am trying to learn the insides of omniauth and am curious as to how it knows to intercept /auth/facebook url. Does it append to the existing routes file? Where can I find the insides of it?

Upvotes: 0

Views: 194

Answers (1)

x1a4
x1a4

Reputation: 19485

It uses a rack middleware to sniff the path that's being requested, and if it matches, calls the associated strategy. The files in question are lib/omniauth.rb and lib/omniauth/strategy.rb.

To see the path taken, start at the call! method in strategy.rb. Pay special attention to anything checking for path_prefix, which defaults to /auth.

Upvotes: 3

Related Questions