summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-07-29 13:48:58 +0200
committerJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-07-29 15:20:02 +0200
commit16c55e4d3b7f640fc45bab9db53217297e985983 (patch)
tree20bc450832b39bde7c0591d465c2addfcb63d579
parentca82a19397ffbd2e7d36784d6969bd3b833f6a24 (diff)
downloadqtenginio-16c55e4d3b7f640fc45bab9db53217297e985983.tar.gz
Improve login code snippet
Many users get confused by an identity object being deleted before the authentication is finished, therefore the snippet should use heap allocation. Change-Id: I7fafe6073680a0c89454e7000fe959ad98bc8b0a Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
-rw-r--r--src/enginio_client/enginioidentity.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/enginio_client/enginioidentity.cpp b/src/enginio_client/enginioidentity.cpp
index 56b8b90..31f38e1 100644
--- a/src/enginio_client/enginioidentity.cpp
+++ b/src/enginio_client/enginioidentity.cpp
@@ -224,11 +224,11 @@ public:
To authenticate an instance of EnginioClient called \a client such code may be used:
\code
- EnginioOAuth2Authentication identity;
- identity.setUser(_user);
- identity.setPassword(_user);
+ EnginioOAuth2Authentication *identity = new EnginioOAuth2Authentication(client);
+ identity->setUser(_user);
+ identity->setPassword(_password);
- client.setIdentity(&identity);
+ client->setIdentity(identity);
\endcode
Setting the identity will trigger an asynchronous request, resulting in EnginioClient::authenticationState()