pipacs / o2

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

MSGraph example not working for Native apps #146

Open lucaotta opened 3 years ago

lucaotta commented 3 years ago

I've created a desktop app in Azure AD and I've added a redirect URL for 127.0.0.1. I've put the client id and the client secret in the msgraph example, but at the end of the authentication I get an error:

O2::onTokenReplyError:  QNetworkReply::AuthenticationRequiredError :  "Host requires authentication"
O2::onTokenReplyError:  "{\"error\":\"invalid_client\",\"error_description\":\"AADSTS700025: Client is public so neither 'client_assertion' nor 'client_secret' should be presented

The example uses O2::GrantFlowAuthorizationCode authentication method. The workaround I've found is to comment the line

parameters.insert(O2_OAUTH2_CLIENT_SECRET, clientSecret_);

from O2::onVerificationReceived.

Is there a better way? Do you think this is due to MS Graph OAuth dialect?