Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug with OAuth10Credentials::fromJSON #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix a bug with OAuth10Credentials::fromJSON
This commit fixes compilation issues on MacOS and Windows described in
issue #51.
loics2 committed Oct 26, 2020
commit f73b9c2e40bfe142d975ceeff476010f09cab86f
17 changes: 11 additions & 6 deletions libs/ofxHTTP/src/OAuth10Credentials.cpp
Original file line number Diff line number Diff line change
@@ -94,12 +94,17 @@ OAuth10Credentials OAuth10Credentials::fromJSON(const ofJson& json)
const auto& key = iter.key();
const auto& value = iter.value();

if (key == "consumerKey") credentials._consumerKey = value;
else if (key == "consumerSecret" || key == "consumer_secret") credentials._consumerSecret = value;
else if (key == "accessToken" || key == "access_token") credentials._accessToken = value;
else if (key == "accessTokenSecret" || key == "access_token_secret") credentials._accessTokenSecret = value;
else if (key == "owner") credentials._owner = value;
else if (key == "ownerId" || key == "owner_id" ) credentials._ownerId = value;
if (key == "consumerKey") credentials._consumerKey = value.get<std::string>();
else if (key == "consumerSecret" || key == "consumer_secret")
credentials._consumerSecret = value.get<std::string>();
else if (key == "accessToken" || key == "access_token")
credentials._accessToken = value.get<std::string>();
else if (key == "accessTokenSecret" || key == "access_token_secret")
credentials._accessTokenSecret = value.get<std::string>();
else if (key == "owner")
credentials._owner = value.get<std::string>();
else if (key == "ownerId" || key == "owner_id")
credentials._ownerId = value.get<std::string>();
else ofLogWarning("Credentials::fromJSON") << "Unknown key: " << key << std::endl << value.dump(4);
++iter;
}