[MSAL Plugin] Error message improvement suggestion

Forge Component
(2)
Published on 22 May (3 days ago) by Walter Robins
2 votes
Published on 22 May (3 days ago) by Walter Robins

Hello,

I'm having some problems where my configuration seems to be ok and login goes as expected - however, cordova plugin returns me "Operation couldn't be completed (MSALErrorDomain error -50000)" from signInInteractive plugin action. This is just the outer exception saying something went wrong and thus provides no real value to developer / ops side of things.

To have meaningful log entries, https://github.com/wrobins/cordova-plugin-msal/blob/master/src/ios/MsalPlugin.m#L185 could perhaps return the contents from NSError userInfo dictionary, as the actual error from MSAL library should be there (MSALErrorDescriptionKey and MSALInternalErrorCodeKey attributes).

Another suggestion would be to add logger callback capability to native plugin (example here), maybe as a configuration option to in MSALInit action.

If it helps, here's my set-up (using the provided demo app):

This is all iOS, haven't tested / looked at Android yet. Minor hiccups aside, I believe I'm facing a trivial issue here - I just need to see what the error message is.

Mega thank you for your efforts creating this plugin!

Solution

Mikko Nieminen wrote:

Hello,

I'm having some problems where my configuration seems to be ok and login goes as expected - however, cordova plugin returns me "Operation couldn't be completed (MSALErrorDomain error -50000)" from signInInteractive plugin action. This is just the outer exception saying something went wrong and thus provides no real value to developer / ops side of things.

Found out the error, Azure AD application attributes should have it's "publicClient": true (if it's a legacy AAD app). For newer AAD apps created with App Registrations experience, this attribute has been replaced by "allowPublicClient" attribute.

Still voting for improved log message capabilities. :D

https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-app-manifest#publicclient-attribute
https://docs.microsoft.com/en-us/azure/active-directory/develop/reference-app-manifest#allowpublicclient-attribute

Solution

Hi Mikko and thanks for your feedback!

These are awesome ideas and I will definitely include them in the next major release of this plugin (along with a few other goodies). Stay tuned!

Hi again Mikko,

You might want to check out my latest release of this plugin that I put out today. It has the iOS error improvements you suggested, as well as the debug logger and some other new options to customize the sign-in experience. Happy developing!