pull state as session UUID from OAuth URL

This commit is contained in:
Stephen Birarda 2014-05-01 12:50:44 -07:00
parent d942054015
commit 5d5292b4b5

View file

@ -82,6 +82,14 @@ void OAuthWebViewHandler::handleSSLErrors(QNetworkReply* networkReply, const QLi
void OAuthWebViewHandler::handleLoadFinished(bool success) {
if (success && _activeWebView->url().host() == NodeList::getInstance()->getDomainHandler().getHostname()) {
qDebug() << "OAuth authorization code passed successfully to domain-server.";
// grab the UUID that is set as the state parameter in the auth URL
// since that is our new session UUID
QUrlQuery authQuery(_activeWebView->url());
const QString AUTH_STATE_QUERY_KEY = "state";
NodeList::getInstance()->setSessionUUID(QUuid(authQuery.queryItemValue(AUTH_STATE_QUERY_KEY)));
_activeWebView->close();
}
}