Giter VIP home page Giter VIP logo

Comments (1)

ewencp avatar ewencp commented on September 26, 2024

This looks like it was an issue with double-encoding the signature in query strings, things probably were working fine with Auth HTTP headers. You can see the double-encoding since the oauth_signature ends with %253D (%25 is the reencoding of %, %3D is '=').

This should be fixed in 4db410f and I added a couple of other fixes for the samples since the Twitter URLs were out of date and one now requires a oauth_callback parameter.

Here's a small patch you can use to very easily run those applications against imgur and verify this is actually fixed for you. It just sets up the right endpoints and makes the simple_request binary get the json listing of your images:

diff --git a/demo/simple_auth.cpp b/demo/simple_auth.cpp
index 98488e5..b61dbcd 100644
--- a/demo/simple_auth.cpp
+++ b/demo/simple_auth.cpp
@@ -9,10 +9,10 @@
  */
 std::string consumer_key = ""; // Key from Twitter
 std::string consumer_secret = ""; // Secret from Twitter
-std::string request_token_url = "https://api.twitter.com/oauth/request_token";
-std::string request_token_query_args = "oauth_callback=oob";
-std::string authorize_url = "https://api.twitter.com/oauth/authorize";
-std::string access_token_url = "https://api.twitter.com/oauth/access_token";
+std::string request_token_url = "https://api.imgur.com/oauth/request_token";
+std::string request_token_query_args = "";
+std::string authorize_url = "https://api.imgur.com/oauth/authorize";
+std::string access_token_url = "https://api.imgur.com/oauth/access_token";


 std::string getUserString(std::string prompt) {
diff --git a/demo/simple_request.cpp b/demo/simple_request.cpp
index 215d76b..443ede2 100644
--- a/demo/simple_request.cpp
+++ b/demo/simple_request.cpp
@@ -12,8 +12,8 @@ std::string consumer_secret = ""; // Secret from Twitter
 std::string oauth_token = ""; // User-specific token acquired by auth process
 std::string oauth_token_secret = ""; // User-specific secret acquired by auth process.
 // An example resource to be accessed, along with parameters for the request
-std::string oauth_protected_resource = "https://api.twitter.com/1/statuses/home_timeline.json";
-std::string oauth_protected_resource_params = "count=5";
+std::string oauth_protected_resource = "http://api.imgur.com/2/account/images.json";
+std::string oauth_protected_resource_params = "";

 std::string getUserString(std::string prompt) {
     std::cout << prompt << " ";

from liboauthcpp.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.