#10 ✓resolved
elysion

Authentication using the example codes does not work

Reported by elysion | May 26th, 2010 @ 10:33 PM | in 1.0.1

I tried authenticating using the addresses from http://term.ie/oauth/example/ and the example code in http://files.ayoy.net/qoauth/1.0/doc/class_q_o_auth_1_1_interface.html. Here's the source:

QByteArray token;

QByteArray tokenSecret;

QOAuth::Interface* qoauth = new QOAuth::Interface;
// set the consumer key and secret
qoauth->setConsumerKey("key");
qoauth->setConsumerSecret("secret");
// set a timeout for requests (in msecs)
qoauth->setRequestTimeout( 10000 );

// send a request for an unauthorized token
QOAuth::ParamMap qoauthReply =
        qoauth->requestToken( "http://term.ie/oauth/example/request_token.php", 
                              QOAuth::GET, QOAuth::HMAC_SHA1 );

// if no error occurred, read the received token and token secret
if ( qoauth->error() == QOAuth::NoError ) {
    qDebug() << qoauthReply.keys();

    token = qoauthReply.value( QOAuth::ParamToken );
    tokenSecret = qoauthReply.value( QOAuth::ParamTokenSecret );

    qDebug() << token;
    qDebug() << tokenSecret;

    QOAuth::ParamMap accessReply = qoauth->accessToken("http://term.ie/oauth/example/access_token.php",
                                                       QOAuth::POST,
                                                       token,
                                                       tokenSecret,
                                                       QOAuth::HMAC_SHA1);

    if ( qoauth->error() == QOAuth::NoError)
    {
        qDebug() << accessReply.keys();
        //qDebug() << accessReply.value( QOAuth::ParamToken )
    }
    else
    {
        qDebug() <<"accessToken"<< (qoauth->error() == QOAuth::OtherError) <<qoauth->error();
    }
}
else
{
    qDebug() << "requestToken"<< qoauth->error();
}

And here is the output:
("oauth_token", "oauth_token_secret") "requestkey" "requestsecret" parseReply - oauth_token not present in reply!
parseReply - oauth_token_secret not present in reply!
("Invalid consumer key



OAuthRequest Object
(
[parameters:OAuthRequest:private] ")

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

QOAuth is a Qt-based C++ library providing means for communicating with services supporting OAuth authorization scheme.

Shared Ticket Bins

People watching this ticket

Referenced by

Pages