wrobins / cordova-plugin-msal

Use the newest Microsoft MSAL library in your Cordova-based project!
Apache License 2.0
23 stars 63 forks source link

adding multiple objects in authorizationQueryStringParameters doesnot show login page #23

Closed collab-appsdev closed 8 months ago

collab-appsdev commented 4 years ago

we have added 2 objects on the authorizationQueryStringParameters, after adding those it shows only whitepage after building the app.

we added another object on the authorizationQueryStringParameters because the token we are generating before throws 401 when upon hitting our API. it seems that we need to add the resourceUri on the link generated upon login to fix the 401 issue.

we added this authorizationQueryStringParameters: [{param: 'domain_hint', value: 'my-tenant-guid'}, {param: 'resource', value: 'resource-value'}];

can you help me?

wrobins commented 4 years ago

Hello! I tried creating a test app with a fresh install in both Android and iOS, and initialized MSAL with the default configuration:

function cb(msg) {console.log(msg);}
cordova.plugins.msalPlugin.msalInit(cb, cb);

Then I called SignInInteractive with what you provided, with my own tenant ID modified for my own Azure Portal instance:

cordova.plugins.msalPlugin.signInInteractive(
     cb,
     cb,
     {
          authorizationQueryStringParameters: [
               {param: 'domain_hint', value: 'my-tenant-guid'},
               {param: 'resource', value: 'resource-value'}
          ]
     }
);

I didn't expect it to work completely given I don't have any custom resources configured, but on both Android and iOS I got the authenticator window with a message: image

When you called SignInInteractive, did you wrap authorizationQueryStringParameters in an object as above? Were there any errors thrown in the console?

johnathon101 commented 4 years ago

@collab-appsdev Remove User.Read from your default scope and set your singular scope in your msalInit function to {Enter Your AppId GUID here}/User.Read, this will give you a token that has the appid as the audience which should get rid of that 401.