pipacs / o2

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

Add %20 causes "Host requires authentication" error #19

Open JoseExposito opened 10 years ago

JoseExposito commented 10 years ago

First I have to say that I'm using this library in a slightly weird way. I'm storing the consumer secret/key and the token/token secret in my DB and creating an O1 object using this code:

O1 *AbstractMessage::createO1()
{
    O1 *oauth = new O1(this);
    oauth->setClientId(loginInfo->consumerKey);
    oauth->setClientSecret(loginInfo->consumerSecret);
    oauth->setToken(loginInfo->token);
    oauth->setTokenSecret(loginInfo->tokenSecret);
    return oauth;
}

QNetworkReply *AbstractMessage::oauthGetRequest(const QString &url)
{
    O1 *oauth = this->createO1();
    O1Requestor *requestor = new O1Requestor(this->networkAccessManager, oauth, this);
    return requestor->get(QNetworkRequest(url), QList<O1RequestParameter>());
}

I don't know if this can cause the error.

Calling to "oauthGetRequest()" with a URL like "https://one.ubuntu.com/api/file_storage/v1/~/foo" works like a charm.

However, when I try to do exactly the same with this URL "https://one.ubuntu.com/api/file_storage/v1/~/foo%20bar" or this other "https://one.ubuntu.com/api/file_storage/v1/~/foo?include_children=true" I'm getting a "Host requires authentication" error.

Could be this a problem with the way I'm using the library or could it be a bug?

pipacs commented 10 years ago

Unfortunately I don't know.

Akos.

Akos Polster http://quantisproject.com

On 20 Nov 2013, at 18:46, José Expósito notifications@github.com wrote:

First I have to say that I'm using this library in a slightly weird way. I'm storing the consumer secret/key and the token/token secret in my DB and creating an O1 object using this code:

O1 AbstractMessage::createO1() { O1 oauth = new O1(this); oauth->setClientId(loginInfo->consumerKey); oauth->setClientSecret(loginInfo->consumerSecret); oauth->setToken(loginInfo->token); oauth->setTokenSecret(loginInfo->tokenSecret); return oauth; }

QNetworkReply AbstractMessage::oauthGetRequest(const QString &url) { O1 oauth = this->createO1(); O1Requestor *requestor = new O1Requestor(this->networkAccessManager, oauth, this); return requestor->get(QNetworkRequest(url), QList()); } I don't know if this can cause the error.

Calling to "oauthGetRequest()" with a URL like "https://one.ubuntu.com/api/file_storage/v1/~/foo" works like a charm.

However, when I try to do exactly the same with this URL "https://one.ubuntu.com/api/file_storage/v1/~/foo%20bar" or this other "https://one.ubuntu.com/api/file_storage/v1/~/foo?include_children=true" I'm getting a "Host requires authentication" error.

Could be this a problem with the way I'm using the library or could it be a bug?

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