omniauth / omniauth-oauth2

An abstract OAuth2 strategy for OmniAuth.
MIT License
502 stars 304 forks source link

set access_token when test_mode=true #60

Open langalex opened 10 years ago

langalex commented 10 years ago

When not in test mode, after the callback phase I can call env['omniauth.strategy'].acces_token.get('/xyz') to make authenticated requests. In test mode access_token is not set as the normal callback phase code is never called.

At the moment I work around this in my tests using

OmniAuth.config.before_callback_phase = ->(env) {
  env['omniauth.strategy'].access_token = env['omniauth.strategy'].send(:build_access_token)
}

but it would be better if this was default behavior.

isaacsanders commented 10 years ago

Care to submit a pull request for this? I would be happy to accept it.