OAuth0 QNetworkAuth
-
Hello everyone in the community,
I, as a newbie, need a bit of help to understand qnetworkauth, specifically with oauth0.I am successfully logging against oauth basing myself on qt webpage's example.
connect(m_oauth, &QOAuth2AuthorizationCodeFlow::statusChanged, [=](QAbstractOAuth::Status status) { if (status == QAbstractOAuth::Status::TemporaryCredentialsReceived) emit authenticated(); });
Now the 2 questions:
- How can I get my user info from my endpoint?
I was trying something like this:
void Authorization::getUserInfo() { QString newUrl{ "https://mydomain.auth0.com/userinfo?access_token=" }; newUrl.append(m_oauth->token()); auto reply = m_oauth->get(QUrl(newUrl)); connect(reply, &QNetworkReply::finished, [=]() { ... }); }
- And finally, how can I send my token together with my requests to my webservice?
Thank you very much!
-
Hello everyone in the community,
I, as a newbie, need a bit of help to understand qnetworkauth, specifically with oauth0.I am successfully logging against oauth basing myself on qt webpage's example.
connect(m_oauth, &QOAuth2AuthorizationCodeFlow::statusChanged, [=](QAbstractOAuth::Status status) { if (status == QAbstractOAuth::Status::TemporaryCredentialsReceived) emit authenticated(); });
Now the 2 questions:
- How can I get my user info from my endpoint?
I was trying something like this:
void Authorization::getUserInfo() { QString newUrl{ "https://mydomain.auth0.com/userinfo?access_token=" }; newUrl.append(m_oauth->token()); auto reply = m_oauth->get(QUrl(newUrl)); connect(reply, &QNetworkReply::finished, [=]() { ... }); }
- And finally, how can I send my token together with my requests to my webservice?
Thank you very much!
@JVargas said in OAuth0 QNetworkAuth:
- How can I get my user info from my endpoint?
I was trying something like this:
...- And finally, how can I send my token together with my requests to my webservice?
are there any errors? Does it work or not? I don't see the actual question here? Or is it just a design-related question?
What is your endpoint? -
Hello everyone in the community,
I, as a newbie, need a bit of help to understand qnetworkauth, specifically with oauth0.I am successfully logging against oauth basing myself on qt webpage's example.
connect(m_oauth, &QOAuth2AuthorizationCodeFlow::statusChanged, [=](QAbstractOAuth::Status status) { if (status == QAbstractOAuth::Status::TemporaryCredentialsReceived) emit authenticated(); });
Now the 2 questions:
- How can I get my user info from my endpoint?
I was trying something like this:
void Authorization::getUserInfo() { QString newUrl{ "https://mydomain.auth0.com/userinfo?access_token=" }; newUrl.append(m_oauth->token()); auto reply = m_oauth->get(QUrl(newUrl)); connect(reply, &QNetworkReply::finished, [=]() { ... }); }
- And finally, how can I send my token together with my requests to my webservice?
Thank you very much!
what service are you using for authentication?
@JVargas said in OAuth0 QNetworkAuth:
if (status == QAbstractOAuth::Status::TemporaryCredentialsReceived)
emit authenticated();this looks like you assume a successful authentication upon the TemporaryCredentialsReceived status. But i think this can't be expected as the name of the status implies. You need the QAbstractOAuth::Granted status for a successful authentication. Thus something more has to be done upon receiving the TemporaryCredentialsReceived status.