summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Ettlin <nicolas.ettlin@me.com>2018-07-02 17:12:26 +0200
committerNicolas Ettlin <nicolas.ettlin@me.com>2018-07-03 11:39:55 +0000
commit55b80f9e7b0a81cf6c80ae0a381a20641194c09e (patch)
treefa94e5979004abbbe0f83eaf26018e5fedce71f7
parent1b2c97d27ab420a893fbd45e864ad29986aa49e0 (diff)
Fix the twittertimeline example
The ‘twittertimeline’ example wasn’t working because it couldn’t find a callback URL to redirect the user to. This was fixed by forcing the HTTP server to listen to a specific port (1337), as it’s done in the Reddit example. This commit also updates the documentation to explain how the users should configure the callback URL on their Twitter app settings. Task-number: QTBUG-68632 Change-Id: Idaaa550ecc37b42f91efa80f63b03d9c222c2e96 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
-rw-r--r--examples/oauth/twittertimeline/doc/src/qtnetworkauth-twittertimeline.qdoc2
-rw-r--r--examples/oauth/twittertimeline/twitter.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/examples/oauth/twittertimeline/doc/src/qtnetworkauth-twittertimeline.qdoc b/examples/oauth/twittertimeline/doc/src/qtnetworkauth-twittertimeline.qdoc
index 7b9e79b..2a7fa4c 100644
--- a/examples/oauth/twittertimeline/doc/src/qtnetworkauth-twittertimeline.qdoc
+++ b/examples/oauth/twittertimeline/doc/src/qtnetworkauth-twittertimeline.qdoc
@@ -39,6 +39,8 @@
To use this example, a consumer key and secret from Twitter are needed.
To register the application visit https://apps.twitter.com.
+ You’ll need to add \e http://localhost:1337/callback as a callback URL
+ in your Twitter app settings.
\include examples-run.qdocinc
*/
diff --git a/examples/oauth/twittertimeline/twitter.cpp b/examples/oauth/twittertimeline/twitter.cpp
index ddc174b..8529537 100644
--- a/examples/oauth/twittertimeline/twitter.cpp
+++ b/examples/oauth/twittertimeline/twitter.cpp
@@ -67,7 +67,7 @@ Twitter::Twitter(const QString &screenName,
QObject *parent) :
QOAuth1(clientCredentials.first, clientCredentials.second, nullptr, parent)
{
- replyHandler = new QOAuthHttpServerReplyHandler(this);
+ replyHandler = new QOAuthHttpServerReplyHandler(1337, this);
replyHandler->setCallbackPath("callback");
setReplyHandler(replyHandler);
setTemporaryCredentialsUrl(QUrl("https://api.twitter.com/oauth/request_token"));