Skip to content

OAuth2 gem: Response becomes SnakyHash::StringKeyed instance despite snaky: false option

Bug Summary

Despite specifying snaky: false as an argument in the OAuth2::AccessToken#get method of the OAuth2 gem, the response turns into a SnakyHash::StringKeyed instance after a redirect.

Steps to Reproduce

  • Use the OAuth2::AccessToken#get method to send a request to an API.
  • Request an endpoint where a redirect occurs, specifying snaky: false as an argument.
  • Upon checking the response, it's observed that instead of the expected Hash type, a SnakyHash::StringKeyed instance is returned.

Environment and Conditions

  • OAuth2 gem version: 2.0.9

Cause

In the OAuth2 gem's OAuth2::Client#execute_request method, this commit introduces params.delete(:snaky), causing the snaky option to be removed when OAuth2::Client#request is called after a redirect.

Expected Behavior

When snaky: false is specified, the response should remain as a Hash type even after a redirect.