While trying to get an OAuth code to get a user access token for Facebook in an integration test, I can't get a URL with the OAuth code in it. If I take the URL generated by calling url_for_oauth_code and stick it in my browser, it redirects me and the resulting URL has a code=XXXXX section, which is what I expect. However, when running the following code, the URL I receive (in response['location']) does not have a code=XXXXX section and is completely different than what I get when simply putting it in the browser. Why am I getting a completely different URL?
oauth = Koala::Facebook::OAuth.new(@appid, @appsecret, @callback)
url = URI(oauth.url_for_oauth_code)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(url.request_uri)
response = http.request(req)
flunk response['location']
Aucun commentaire:
Enregistrer un commentaire