songkick / oauth2-provider

Simple OAuth 2.0 provider toolkit
MIT License
529 stars 148 forks source link

Provider.parse doesn't like RSpec env. #68

Closed midwire closed 8 years ago

midwire commented 10 years ago

Whenever I try to authenticate in my specs, I can get a code just fine with:

@auth = Songkick::OAuth2::Provider::Authorization.new(@user, params)

However, when I try to get the access_token:

@oauth2 = Songkick::OAuth2::Provider.parse(@user, env)

it consistently fails. It seems the Router, after making this call:

request = request_from(env)

strips out the parameters, so the next call:

params = request.params

is always an empty hash.

Am I doing something wrong?

I can make the same calls using curl and everything works just fine. The RSpec mock environment seems to cause problems. Is that by design?

kaborso commented 9 years ago

@midwire I'm having the same issue.

midwire commented 9 years ago

I think all you need to do is include rack-test in your Gemfile.

gem 'rack-test', :require => 'rack/test'
kaborso commented 9 years ago

Thanks, I'll give that a try!