1

I'm trying to develop a drive solution (Onedrive) in a windev program.

I created an application in Microsoft Azure and created a secret key.

enter image description here

enter image description here

When doing the first request https://login.live.com/oauth20_authorize.srf?client_id={client_id}&scope={scope} &response_type=code&redirect_uri={redirect_uri} I'm redirected on the connection page.

Once I'm connected I get a code back as https://login.live.com/oauth20_authorize.srf?code={code}.

But when I ask for a token posting this request : POST https://login.live.com/oauth20_token.srf Content-Type: application/x-www-form-urlencoded client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret} &code={code}&grant_type=authorization_code

I get this back

{ "error":"invalid_client", "error_description":"The client does not exist or is not enabled for consumers. If you are the application developer, configure a new application through the App Registrations in the Azure Portal at https:\/\/go.microsoft.com\/fwlink\/?linkid=2083908.", "correlation_id":"471e800c-69b4-43c6-a03f-a1f7e9512e6b" }

Thank you for your help.

Kazh
  • 35
  • 1
  • 5

1 Answers1

2

This error means you are using a Microsoft Account to login your client app, but it is not enabled for that.

To change the setting for an existing AD App, navigate to the Manifest blade of it in the portal, find the signInAudience attribute, set it with AzureADandPersonalMicrosoftAccount or PersonalMicrosoftAccount.

enter image description here

Carl Zhao
  • 8,543
  • 2
  • 11
  • 19
  • Thank you for your answer. I tried that but I can't save the manifest when I change that attribut. I get this message : Échec de la mise à jour de l'application BeeImmo. Détail de l'erreur : Le schéma d'URI est non valide ou non pris en charge. [QGW5pi3Jc5avTk0rwGHXi+] In English it should be: The URI scheme is not valid or not supported. – Kazh Apr 23 '21 at 09:31
  • @Kazh Have you changed other configurations of the manifest? – Carl Zhao Apr 23 '21 at 09:34
  • Not at all. I'm going to post my manifest with hidden ids for you. – Kazh Apr 23 '21 at 09:37
  • @Kazh Another way is to select this option when creating the application https://i.stack.imgur.com/IeFdM.png – Carl Zhao Apr 23 '21 at 09:39
  • @Kazh I think it may be the reason for replying to the url. You can provide me with the manifest information and let me take a look. – Carl Zhao Apr 23 '21 at 09:43
  • @Kazh The problem is here: https://i.stack.imgur.com/SDIWt.png – Carl Zhao Apr 23 '21 at 09:46
  • To be honest I don't understand where is the problem. Do I have to delete some of these? It's the first time I deal with these api I'm sorry. – Kazh Apr 23 '21 at 09:52
  • @Kazh I just found a similar problem, which seems to be related to your `Application ID URI`. https://i.stack.imgur.com/0gBvM.png – Carl Zhao Apr 23 '21 at 10:04
  • @Kazh see: https://stackoverflow.com/questions/59459255/why-does-signinaudience-azureadmultipleorgs-cause-the-uri-scheme-is-invali – Carl Zhao Apr 23 '21 at 10:06
  • That was not a problem for me. See: https://prnt.sc/11x256q Multi-tenant is enabled. – Kazh Apr 23 '21 at 10:13
  • @Kazh What you need is to set up your application to allow personal account login, not just a multi-tenant application. Because you are currently using your personal account to log in to the application. – Carl Zhao Apr 23 '21 at 10:16
  • @Kazh You can re-register an application and choose: `Accounts in any organizational directory (Any Azure AD directory-Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)`, test it . – Carl Zhao Apr 23 '21 at 10:28