...
else if(state==REQUESTTOKEN) {
state = GOTTOKEN;
int endValue = strReply.indexOf("&",0);
int startValue = strReply.indexOf("=",0);
token = new QString(strReply.mid(startValue+1,endValue-startValue-1));
QString *username = new QString(strReply.mid(strReply.lastIndexOf("=")+1));
qDebug() << "username: " << *username;
//you can extract the username too from this url
saveSettings(); //save on the app data directory the token.
}
...