You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom callback_path uses bait and switch with request_path #630
Otherwise the custom callback path evaluator will always be truthy and so Omniauth will run the callback phase on every request.
As for your question about the request_path typo, it's my understanding that this is not a typo, but rather allows for a kind of mapping of request paths to custom callback paths. For example:
While I don't entirely understand the reasoning behind mapping request paths to custom callback paths, I can certainly respect the decision.
However, it seems that if I do not want this mapping feature and instead want to define an explicit callback_path evaluator, then OmniAuth shouldn't get in the way.
I imagine that if you want a request/callback mapping, you wouldn't define a callback_path evaluator in the first place. So simply checking if there is a callback_path evaluator before falling back to the request_path evaluator should address both situations:
Additionally, is there any documentation on how you'd use and why you'd want the request/callback mapping?
It seems like a confusing feature and the code itself failed the Principle of Least Astonishment, in my opinion, as I had the same "this must be a typo" reaction that @canadaduane did.
How would people feel if we changed it so there were a separate is_callback_path callback for dynamic path checking and the callback_path one is used to generate the path?
I was facing issues with having a dynamic callback_path, so this is how we solved it (seems bit hackish but I couldn't find any other way)
Our case: We have 2 authentications: one for User (login) and another for Profile (to grab page data).
so for profiles our url is /auth/facebook?scope=<different scope> and for users is /auth/facebook?resource=user
and we split the callback routes like this
Activity
watsonbox commentedon Apr 10, 2013
I think what you want is something like:
Otherwise the custom callback path evaluator will always be truthy and so Omniauth will run the callback phase on every request.
As for your question about the
request_pathtypo, it's my understanding that this is not a typo, but rather allows for a kind of mapping of request paths to custom callback paths. For example:This example isn't dynamic as such, but you could use regex matching etc to achieve that.
dlindahl commentedon Jun 14, 2013
While I don't entirely understand the reasoning behind mapping request paths to custom callback paths, I can certainly respect the decision.
However, it seems that if I do not want this mapping feature and instead want to define an explicit callback_path evaluator, then OmniAuth shouldn't get in the way.
I imagine that if you want a request/callback mapping, you wouldn't define a callback_path evaluator in the first place. So simply checking if there is a callback_path evaluator before falling back to the request_path evaluator should address both situations:
Before:
After
Right?
Additionally, is there any documentation on how you'd use and why you'd want the request/callback mapping?
It seems like a confusing feature and the code itself failed the Principle of Least Astonishment, in my opinion, as I had the same "this must be a typo" reaction that @canadaduane did.
Correctly report callback path when custom callback path evaluator is…
BRMatt commentedon Jul 2, 2013
I agree with @dlindahl, this is somewhat hard to understand. It seems the helpers are trying to do 2 things:
How would people feel if we changed it so there were a separate
is_callback_pathcallback for dynamic path checking and thecallback_pathone is used to generate the path?And then an implementation of
callback_pathas @dlindahl described it?dlindahl commentedon Jul 2, 2013
Seems reasonable to me
tmilewski commentedon Feb 12, 2017
Closing per #693
emirikol commentedon Aug 17, 2017
Was this ever addressed? it doesn't seem like #693 was actually merged.
leo-souza commentedon Feb 14, 2018
I was facing issues with having a dynamic
callback_path, so this is how we solved it (seems bit hackish but I couldn't find any other way)Our case: We have 2 authentications: one for User (login) and another for Profile (to grab page data).
so for profiles our url is
/auth/facebook?scope=<different scope>and for users is/auth/facebook?resource=userand we split the callback routes like this