cordova-plugin-msal
Advanced tools
Comparing version 2.2.0 to 2.3.0
{ | ||
"name": "cordova-plugin-msal", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "A Cordova plugin providing a wrapper for Microsoft's MSAL library for Android and iOS.", | ||
@@ -5,0 +5,0 @@ "cordova": { |
@@ -260,3 +260,49 @@ # Cordova MSAL Plugin | ||
## Logging/Debugging | ||
You can enable the MSAL logger in this plugin by simply calling: | ||
```js | ||
window.cordova.plugins.msalPlugin.startLogger(successcallback(entry), failcallback(error), false, 'VERBOSE'); | ||
``` | ||
The error in the fail callback is the exception string you know and love. The argument in the success callback ('entry' in this example) is an object with the following structure: | ||
```js | ||
{ | ||
timestamp: string, | ||
threadId: number, | ||
correlationId: string, | ||
logLevel: string, | ||
containsPII: boolean, | ||
message: string | ||
} | ||
``` | ||
### timestamp | ||
The date/time (to-the-minute resolution) of the log entry | ||
### threadId | ||
Identifies the OS-level thread that was running during this operation | ||
### correlationId | ||
Sometimes 'UNSET' if unavailable, but otherwise is a GUID-format string generated by the native code that uniquely identifies an MSAL operation that took place so that if you collect these logs, you can group entries by transaction. | ||
### logLevel | ||
See below | ||
### containsPII | ||
See below | ||
### message | ||
The log message with all related metadata stripped out and placed elsewhere in this structure. | ||
Note here that the callbacks here will be called over and over again each time MSAL logs something, which will be many times per second with dozens of log entries. So the success callback in particular should be something that either spits out each entry it gets to the console or some other handler in your application. | ||
The third and fourth arguments to startLogger() are optional, but can further control the logger. | ||
The first is a boolean (false by default) that tells it whether to include log messages that contain PII (Personally-Identifiable information) such as account IDs and credentials. Be very careful with this and only use it if you absolutely need to for debugging, and NEVER use it in production or store these data unattended. You have been warned and I am not responsible for anything bad that happens as a result of leaving this enabled. | ||
The second argument is a string that filters which log messages are returned from the native code. There are 4 levels that can be passed in (most verbiage shamelessly stolen from [Microsoft's documentation](https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-logging): | ||
### 'VERBOSE' | ||
Default if you provide nothing here. MSAL logs the full details of library behavior. | ||
### 'ERROR' | ||
Indicates something has gone wrong and an error was generated. Use for debugging and identifying problems. | ||
### 'WARNING' | ||
There hasn't necessarily been an error or failure, but are intended for diagnostics and pinpointing problems. | ||
### 'INFO' | ||
MSAL will log events intended for informational purposes not necessarily intended for debugging. | ||
Note that once the logger is started it can't be stopped for the duration of your app being open. This is a limitation from Android's implementation of MSAL; once the logger callback has been defined it can't be modified or an exception is thrown. | ||
## Troubleshooting | ||
@@ -263,0 +309,0 @@ This plugin uses androidx features. If you get an error complaining about conflicting dependencies, you might need to add a couple of plugins to provide androidx compatibility, but your results may vary depending on if you are building locally or with a cloud-based utility. |
@@ -43,2 +43,5 @@ module.exports = { | ||
}, | ||
startLogger: function(updateCallback, errorCallback, containsPII = false, logLevel = 'VERBOSE') { | ||
cordova.exec(updateCallback, errorCallback, 'MsalPlugin', 'startLogger', [containsPII, logLevel]); | ||
}, | ||
getAccounts: function(successCallback, errorCallback) { | ||
@@ -45,0 +48,0 @@ cordova.exec(successCallback, errorCallback, 'MsalPlugin', 'getAccounts', []); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6982277
66
312