Oauth 2 and QTCPServer issue



  • I'm using QT lib https://github.com/pipacs/o2 for authorization using Oauth 2.0. For example i can try to authorize in facebook using example provided in there. If I use GrantFlow AuthorizationCode everything works fine, but if i switch to GrantFlowImplicit authorization fails. After research I found that in void O2ReplyServer::onBytesReady() method when it read data from socket I've got empty query string!
    @GET / HTTP/1.1
    Host: 127.0.0.1:1965
    Connection: keep-alive
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4@
    But when I look in my browser I can clearly see a access_token and so on after #.

    How can I receive data placed after #?

    I'm using Qt 5.4 beta on Mac OS X



  • I can describe the problem in the abstract of the library used. When a local QTCPServer handles redirect from the social network with URI like this:
    @http://127.0.0.1:1965/?#access_token=CAADPRS5aPeABAPGqlEILMSdRlNMGBK0wUU38GmWTWrTPwV39j5ToNaOKoTlKVJBs2icOKesdKQOEgYF8JAWcWnZASOs8ZAdyNfpbKRq9VVI7HtFrYBAfyBikpqqk6KjsvZBFcdjxBZAAymGKj0OwTyjtKHRNsgTKcqSLZCnHWt3gGuGZBWWKKFBjeZAfzZBOH9Q91GXLEbpnZCIFU5y1qtIoE&expires_in=5160500@
    (I can see it in my browser), after reading all received data from soket
    @socket->readAll();@

    there is no query string at all:
    @GET / HTTP/1.1
    Host: 127.0.0.1:1965
    Connection: keep-alive
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
    User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4@
    The question is: why browser shows me /?#access_token=CAA... but QTCPServer shows only / ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.