intridea/omniauth — pull request #676 by watsonbox (2013-04-10 10:33:58+00:00)
Title: Dynamic Paths: Callback path not being correctly reported when custom callback path evaluator is truthy

In using `omniauth-youtube`, I kept getting the following error on the callback phase:

(youtube) Callback phase initiated.
(youtube) Authentication failure! invalid_credentials: OAuth2::Error, redirect_uri_mismatch:
{
"error" : "redirect_uri_mismatch"
}

It turned out that when dynamically setting the callback path (with a lambda), the callback_path on the strategy was not correctly set during the callback phase. When `omniauth-oauth2` tried to build an access token, it sent the wrong redirect URL, and Google's API would respond with an error.

https://github.com/intridea/omniauth-oauth2/blob/master/lib/omniauth/strategies/oauth2.rb#L100

I've made some changes to fix this by using the current_path as the callback path whenever the custom callback path evaluator is truthy.