Hi,

I have to create an application in which the user will provide a username and a password to connect to a web server and I have to do it with oAuth2.0.
So I created the following (by looking at Facebook and Twitter demo provided with oAuth).

Qt Code:
  1. const char CLIENT_ID[] = "...";
  2. const char CLIENT_SECRET[] = "...";
  3. const char REQUEST_URL[] = "...";
  4. const char TOKEN_URL[] = "...";
  5.  
  6. oAuthClass::oAuthClass(QObject *parent) :
  7. QObject(parent)
  8. {
  9. O2* o2Auth = new O2(this);
  10.  
  11. o2Auth->setClientId(CLIENT_ID);
  12. o2Auth->setClientSecret(CLIENT_SECRET);
  13. o2Auth->setRequestUrl(REQUEST_URL);
  14. o2Auth->setTokenUrl(TOKEN_URL);
  15.  
  16. // Create a store object for writing the received tokens
  17. O2SettingsStore *store = new O2SettingsStore(O2_ENCRYPTION_KEY);
  18. store->setGroupKey("oAuth");
  19. o2Auth->setStore(store);
  20. }
To copy to clipboard, switch view to plain text mode 

And I am completely stuck there , I don't know what to do .
I think that I have to use the O2Requestor class which permits to create post request. Something like :

Qt Code:
  1. QNetworkAccessManager *manager;
  2. O2Requestor* o2Requestor = new O2Requestor(manager,o2Auth);
  3.  
  4. QNetworkRequest* request = new QNetworkRequest(...);
  5. /* I have the informations for the header
  6. { { "Authorization", "Basic <CLIENT_ID:CLIENT_SECRET>" },
  7. { "ContentType", "x-www-form-urlencoded" },
  8. { "grant_type", "password" },
  9. { "username", "<username>" },
  10. { "password", "<userpassword>" } }
  11.  
  12. so I can create a post request.
  13. */
  14.  
  15. o2Requestor->post(request, ...);
To copy to clipboard, switch view to plain text mode 

So are those steps good or am I wrond?
In addition, there is a lot of signals / slots in O2 class. I think I have to use them if I want to know if the connection is ok, if the token must be refreshed, ...
(If you knwon a good tutorial about how to use oAuth2.0 in Qt C++, I would appreciate a lot )
Thanks.