pipacs / o2

OAuth 2.0 for Qt
BSD 2-Clause "Simplified" License
317 stars 147 forks source link

Sorry for troubling you again....But I really need your help~ #4

Closed SSSANTON closed 11 years ago

SSSANTON commented 11 years ago

After reading the lastest README doucument you just uploaded,I still can't use this library to make an Open Platform Client(Sina weibo, like facebook) through oauth2 authorization which based on desktop(win7) enviorment.Is that this library not support in desktop application?

According to my poor knowledge about network and HTTP methods.I learnt that the o2reply is use for deal with the QNetworkreply queue.And the o2replyserver is use for handle the data from the TCP socket.At last,the o2requestor is for GET or POST with the token to use the API.But what make me painful is how all these stuff works in a project.I really want to know is the procedure of the the library(very hopeful).

1.Why it use the TCP instead of the QNetworkReply for processing the Authorization Reply? 2. (1)What is the purpose of O2::LINK? (2)Why the RediretUrl is http://localhost:%1/").arg(replyServer_->serverPort()?Can I change it which I had setted on callbackURL setting of the platform I used? (3)It that right once the SIGNAL openBrowser(url) is emited,the newconnection from QTCP will be emitted?It's that means that we open the brwoser(Qurl) just for get response from the TCP port and have a TCP newconnecttion?If is is not?And how to active the SIGNAL newconnection? (4).All the problems troubles me,because it is impossible to get the "CODE" with for acces the TOKEN. without sloving these problem.And could you please give me some advice for getting the CODE from the firt step of the oauth2.0 protocol.

Anyway,no matter you answer all these problems or no,still thanks for share such wonderful oauth2.0 library based on QT,cause such properties is extremly less.And all these problems may only for one reason------I am a typical noob~~~ orz

pipacs commented 11 years ago

Hi, I don't know much about Windows or Sina Weibo, but here are my O2 related answers

~ Akos.

On Feb 6, 2013, at 14:04, SSSANTON notifications@github.com wrote:

After reading the lastest README doucument you just uploaded,I still can't use this library to make an Open Platform Client(Sina weibo, like facebook) through oauth2 authorization which based on desktop(win7) enviorment.Is that this library not support in desktop application?

According to my poor knowledge about network and HTTP methods.I learnt that the o2reply is use for deal with the QNetworkreply queue.And the o2replyserver is use for handle the data from the TCP socket.At last,the o2requestor is for GET or POST with the token to use the API.But what make me painful is how all these stuff works in a project.I really want to know is the procedure of the the library(very hopeful).

They are all very similar to their O1 equivalents which is demonstrated in the example Twitter app in the README.

1.Why it use the TCP instead of the QNetworkReply for processing the Authorization Reply?

Because O2ReplyServer is a complete web server. That's how you write network servers in Qt.

(1)What is the purpose of O2::LINK?

This is the method that initiates logging in. So when the user presses the login button for example, you should call this method

(2)Why the RediretUrl is http://localhost:%1/").arg(replyServer_->serverPort()?Can I change it which I had setted on callbackURL setting of the platform I used?

That's a default URL which works for most OAuth providers. You can have a custom one, if Sina Weibo requires it. See the Skydrive customization for example in o2skydrive.cpp.

(3)It that right once the SIGNAL openBrowser(url) is emited,the newconnection from QTCP will be emitted?It's that means that we open the brwoser(Qurl) just for get response from the TCP port and have a TCP newconnecttion?If is is not?And how to active the SIGNAL newconnection?

There is one point in the authentication sequence when the user has to enter name, password, possibly other credentials, authorise your application to access his account etc.

All these need a web UI which you must provide by opening a browser window with the given URL. But the rest of the interaction will be taken care by the service provider.

(4).All the problems troubles me,because it is impossible to get the "CODE" with for acces the TOKEN. without sloving these problem.And could you please give me some advice for getting the CODE from the firt step of the oauth2.0 protocol.

The O2 library will take care of all these. Once the authentication sequence has completed (when you get the linkingSucceeded signal), CODE and TOKEN will be available in the your O2 object instance, in the "code" and "token" properties.

And you don't even need to deal with code and token yourself, if you are using the O2 library for creating authenticated requests, using O2Requestor and O2Reply.

O2Requestor is like QNetworkAccessManager, but instead of sending plain network requests, it creates and sends authenticated requests.

O2Reply is like QNetworkReply, plus it handles network timeouts and expired tokens.

Anyway,no matter you answer all these problems or no,still thanks for share such wonderful oauth2.0 library based on QT,cause such properties is extremly less.And all these problems may only for one reason------I am a typical noob~~~ orz

— Reply to this email directly or view it on GitHub.

SSSANTON commented 11 years ago

Hi! My friend Akos: In these days,I still working on it and I tried to modify some part of your code,using the QWebView signal(Urlchanged) to get the CODE and the following step is use the QScriptEngine to get the ACCESS_TOKEN.After finishing the oauth2 authorization,I finally managed to update the status in the sina weibo platform!!!

I can't overcome the problems and keep my patience without your generous help! So I have to thank you again! Best wishes!! ^ ^