Giter Site home page Giter Site logo

cordova-plugin-msal's People

Contributors

emmapainter avatar fordkilleen avatar hugoplatell avatar jetro223 avatar johnathon101 avatar kratz00 avatar orjandh avatar peitschie avatar wrobins avatar zailleh avatar zbarbuto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-msal's Issues

Return Types not as Documented using ionic-msal-native

Good Morning,

I'm using your plugin in conjunction with ionic-msal-native and the return types aren't as expected. As opposed to what is outlined here https://github.com/wrobins/cordova-plugin-msal#response-object signInInteractive() returns just the token and signInSilent() returns just the user id. As far as I can tell ionic-msal-native is just a wrapper that returns directly from this library.

Packages Used:
cordova-plugin-msal version 2.5.0
ionic-msal-native version 0.1.0

Cannot log out on ios

Hi.
first of all thanks for your work. This plugin is a real life saver.
I don't know if this is the right place to raise a question but here I am.
Secondly, I cannot log out of IOs. I have configured it with a single account so I dont pass the user ID but it's not logging out.
thanks

iOS signInSilent does not work

signInSilent always gives me the error "No accounts found on device" even after a successful signInInteractive. This only happens on iOS on Android signInSilent works fine.

How to specify the reply URL?

Good day,
The reply URL specified in the request does not match the reply URLs configured for the application: 'xxxxx'
How do I supply it or what do I set in the Azure portal?

sample cordova project will help

Hi Walter,

Please create a sample cordova project using this plugin , this will help a lot.
I am trying to migrate from MS-ADAL to MSAL for authentication.

adding multiple objects in authorizationQueryStringParameters doesnot show login page

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?

Authentication fails when MS broker is installed on device

Ionic 4/Angular project
I have had successful implementation of the MSAL login in iOS and Android up until the Microsoft Authenticator is present on the device.

In Android. as soon as the Microsoft Authenticator broker is installed on the device the plugin does not complete initialization and fails silently. Authentication works fine when the broker is not installed on the device.

In iOS, the authenticator account screen is presented, once an account is selected from the authenticator it loads the application. The error callback is fired with NSDomainError 50000.

I have put breakpoints throughout the MSAL framework library to try to capture a more meaningful error description but have been unable to.

Initialization is in the platform OnReady function. I have quadruple checked my tenant, client and hash keys and ensured they are passed into the sign in function in MSAL as well as returnUris in the MS Azure Portal, tried using MSAL from the cocoapod to go through the implementations and see what could be causing the error itself. I have tried varying settings in initialization including sending in the authority, adding a domain_hint, alternating AzureADMyOrg with the more open instances, changing user agent to DEFAULT provider. I verified the return URI is built correctly and present in the manifest and info.plist along with the scheme definition and msauthv2/v3 schemes.

At this point I am out of ideas, any help would be much appreciated!

Steps to reproduce:
Install Ionic new application, install cordova-plugin-msal with tenant/client/hash, enable broker authentication, install Microsoft Authenticator on device, try to sign in.

iOS Error:
2020-05-19 06:22:50.066480-0500 TestProject[1710:562091] IonicDeepLinkPlugin: Handle link (internal) msauth.{Bundle Identifier is Here}://auth/broker?msg_protocol_ver=3&response={Huge Encrypted String}&hash={Base 64 String}
TestProject[1710:562091] IonicDeepLinkPlugin: Handle link (internal) msauth.{Bundle Identifier is Here}://auth/broker?msg_protocol_ver=3&response={Huge Encrypted String}&hash={Base 64 String}
TestProject[1710:562091] url scheme:msauth.{Bundle Identifier is Here}
TestProject[1710:562091] url host:auth
TestProject[1710:562091] Log in failed.
TestProject[1710:562091] The operation couldn’t be completed. (MSALErrorDomain error -50000.)

Gist of initi/login: https://gist.github.com/johnathon101/125a103c25d3dfd9a09c587193f07c55

different redirect URIs in different platforms

Redirect URI that is set by default seems to be different depending on the platform (IOS or Android).
In IOS it is set as:
... redirectUri:[NSString stringWithFormat:@"msauth.%@://auth", ...

And in android as:
... "redirect_uri\" : \"msauth://" + MsalPlugin.this.activity.getApplicationContext().getPackageName() + "/" + keyHashUrlFriendly + "\",\n"...

It took me some time to find out. I could not find that documented anywhere and Safari keeps showing the error : "cannot open the page because the address is invalid" when SignInInteractive is executed.

Thanks.

Meteor mobile_config.js file to configure TENANT_ID and CLIENT_ID

Hello:
I am using Meteor JS 2.2. When adding a Cordova plugin, one cannot pass in variables when adding/installing the plugin. Any variables needed such as CLIENT_ID/TENANT_ID go into a file at the root of the project named mobile-config.js. The syntax is this:

App.configurePlugin('cordova-plugin-msal.msalPlugin', {
CLIENT_ID: 'b50e6a4c-a9c9-4668-a49f-16a64f038adc',
TENANT_ID: '36226acb-be98-4ea0-aa7d-700781c294a9'
})

However, in my Xcode project, viewing the config.xml cordova file does not show these settings. I have also tried simply 'msalPlugin' as the name of the plugin.

Any ideas?

Thank you to all

Plugin does not trigger brokered authentication

Hello, thanks for the great plugin, but for some reason it does not redirect to Microsoft authenticator or company portal to log the user in, any idea why?

export const environment: FCSMEnvironment = {
  ...
  msal: {
    authorities: [
      {
        type: 'AAD',
        audience: 'AzureADMyOrg',
        authorityUrl: 'https://login.microsoftonline.com/xxx.onmicrosoft.com',
        default: true
      }
    ],
    authorizationUserAgent: 'DEFAULT',
    multipleCloudsSupported: false,
    brokerRedirectUri: true,
    accountMode: 'SINGLE',
    scopes: ['xxx-xx-42bb-b5a6-xx/.default']
  },
  ...
};

I followed the iOS setup guide step by step. (https://github.com/AzureAD/microsoft-authentication-library-for-objc#adding-msal-to-your-project)

Getting error in the time on App compilation

I used cordova-plugin-msal in my Android Application, When I try to compile my Android application for testing on that time I get an error:

`:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResourcesC:\Users\test.gradle\caches\transforms-1\files-1.1\appcompat-1.0.2.aar\fc9fe9b92c142495ba79e017cf18ca94\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

C:\WebContent\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

C:\Users\test.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\9d7a7dfeba2eb16cae5bc7d90fa05488\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontVariationSettings not found.

C:\Users\test.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\9d7a7dfeba2eb16cae5bc7d90fa05488\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/ttcIndex not found.

Exception in thread "stderr" java.util.UnknownFormatConversionException: Conversion = 'P'
at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691)
at java.util.Formatter$FormatSpecifier.(Formatter.java:2720)
at java.util.Formatter.parse(Formatter.java:2560)
at java.util.Formatter.format(Formatter.java:2501)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:178)
at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:144)
at com.android.ide.common.process.LoggedProcessOutputHandler.handleOutput(LoggedProcessOutputHandler.java:44)
at com.android.ide.common.process.TeeProcessOutputHandler.handleOutput(TeeProcessOutputHandler.java:59)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.handleOutput(AaptProcess.java:457)
at com.android.builder.png.AaptProcess$NotifierProcessOutput.err(AaptProcess.java:415)
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:332)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:104)
`

plugin was not working in Android

While integrating the plugin into our Cordova application and triggers the signIn, it doesn't works in the Android. Simple it throws the below error always even I already initialized the msal.

image

But the same was working in iOS, and the login screen was initiated.

I am not sure whether any configuration issue there in Android, but followed all the required configurations from the MSAL wiki..

Versions:
cordova-android: "^9.0.0"
cordova-ios: "~5.1.1",

Azure Guest account login

I am having environment where we have enabled guest login for third party vendors in Azure AD. Authentication is working fine for my organisation but it fails for Guest users. I am getting "Your account or password is incorrect. if you don't remember your password reset it"

Can you please help to resolve the issue.

Signout closing the app

Hello,

I am using your plugin for application signIn on android devices for a single account, I am facing an issue where as soon as I hit logout it is closing my app, here is my code for logout.

public logout(): void {
const isMsalPluginAvailable = typeof (cordova.plugins.msalPlugin) !== 'undefined';
if (isMsalPluginAvailable) { // true
this.msalPlugin.signOut( // after this step it is closing the app.
(success) => {
console.log('******DEBUGGGGGGGGG MOBILE LOGOUT WORKS!!!', success);
},
(err) => {
console.log('******DEBUGGGGGGGGG MOBILE LOGOUT FAILED!!!', err);
}
);
}
}

All I am expecting is if it comes to either success or err callback I can do my logic.

Need MSAL Cordova which is compatibility with Cordova version 6.5.0

Since our mobile application are running on Cordova 6.5.0. Please give me a version which will be working with Cordova 6.5.0.

Need your help on this.

Error : Plugin doesn't support this project's cordova version. cordova: 6.5.0, failed version requirement: >=7.0.0

Thanks,

How to switch policies ?

I have a B2C configured for android, and I would like to be able to specify which policy I am using on a specific action.
Seems that for now in order to change the policy, I have to run msalInit with the new configuration of the authority url . Is there any other way ? It will be great if I can pass a number or a kind of a key of the authority with which I would like my explicit login to be executed. Or directly to pass url of the authority which should be used. Then .fromAuthority(uri) can be used in signinUserInteractive and if uri is supplied in the param, then it can be used. This will allows you to run all flows which are specified in the corresponding B2C policy.

How to add access scopes for APIs

Hi Team-

Can someone help me understand how to add access scopes for APIs to this code? I have tried adding scopes via the scopes array, the protectedResourceMap (as in other instances of MSAL) and the otherScopesToAuthorize array as shown in the screen shot below. In my token, the scopes are always applied towards the MS Graph API in each case.
Can you tell me the correct way to add scopes for accessing APIs?
You will see my decoded token below, where the scope is applied for the Graph API only.

Thank you

5114_bug1

5114_bug2

Azure login not working - Unable to open the Login popup

HI,

We have created a Cordova app with Framework 7 version 2. Working on enabling Azure MFA authentication, Installed the Codova-plugin-msal. Given below configuration. Gave the tenent_id, cliend_id & Signature has value during the plugin installation. Still it is not working MSALInit is not working, Please help me on this .

var defaultOptions1 = {
authorities: [
{
type: 'AAD',
audience: 'AzureADMyOrg',
authorityUrl: '',
cloudInstance: 'MSALAzurePublicCloudInstance',
default: true
}
],
authorizationUserAgent: 'DEFAULT',
multipleCloudsSupported: false,
brokerRedirectUri: true,
accountMode: 'SINGLE',
scopes: ['User.Read']
};

window.cordova.plugins.msalPlugin.msalInit(function() {
alert('msalInit');
},
function (err) {
alert('msalInit' + err);

}, defaultOptions1);

window.cordova.plugins.msalPlugin.signInInteractive(
function(resp) {
alert(resp);
},
function(err) {
}
);

OpenId Provider Configuration metadata failed to load with status: 404 Android

Hi all,
I am trying to integrate this library, but I cannot get it to work as expected.
"cordova-plugin-msal": "^2.5.0",
"ionic-msal-native": "^0.1.0",
My current setting:

options: any = { client_id: "[client_id]", authorizationUserAgent : "DEFAULT", redirect_uri: "msauth://[appid]/6FYh01XNTEyXhtp64rz5FV5gIpA%3D", authorities: [ { type: 'B2C', audience: 'AzureADMyOrg', authorityUrl: "https://[appnam].b2clogin.com/tfp/[appname].onmicrosoft.com/B2C_1_Login/", default: true } ], scopes: ['openid','offline_access'] }

I have a problem to setup up the scope.
This scope will return the following error no matter what I change it to. The error is:
OpenId Provider Configuration metadata failed to load with status: 404 Android

If I change it to ''https://[appname].onmicrosoft.com/[client_id]/user.read', error still occurs.
But it returns access_token. I dont receive the result as a example has shown below:

{ token: 'eyJ0eXAiOiJKV1QiLCJub...', account: { id: 'abc-someguid-123', username: '[email protected]', claims: [ {key: "name", value: "Robins, Walter"}, {key: "ver", value: "2.0"}, { ... } ] } }

How do I set up this library or my Azure B2C to get the profile return on login?
Thanks

Its urgent!!. After execute signInInteractive(), the Microsoft login page takes 2 min approx to appear on the screen.

Please Help me. Its urgent!!.

After execute signInInteractive(), the Microsoft login page takes 2 min approx to appear on the screen.
but after once login completed, signInSilent() function completes its operation within 2-4 seconds and takes the user to the application home page.

Why Microsoft login page takes 2 - 3 min to appear on the screen after executing signInInteractive().

Using Client_ID for different szenarios (test, staging, prod)

Hi,
thanks for your work.

In your plugin the CLIENT_ID is mandatory. Do you know a best practice to change this on runtime of Xcode-Build without removing and adding the plugin everytime with new ID?
Because I currently try to build a CI project with using schemes in Xcode, but didn't really know how to change this parameter when using & building with this plugin with less effort. So I will end up in using two projects.

Auth Results not returning

Currently this plugin in only returns the accessToken and not the entire Auth Results. Is there anyway this can be modified in the delegate commands so it returns entire results on both silentSignIn and interactiveSignIn?

Application is not configured as a multi-tenant application

Hi,
when i try the Demo in outsystems application, and integrate with Azure (supported account types: Single tenant)
then encounter below error. if I change supported account types to Multitenant, then it work.

how can i make it work for Single tenant also?
I have tried
e.g.

  1. pass AuthorityUrl: https://login.microsoftonline.com/[tenant-id] to MSALInit
  2. change AccountMode to Single / Multiple
  3. change MSALAuthority.Audience
  4. change Entities.AuthorityType.B2C / Entities.AuthorityType.AAD
  5. ....
AADSTS50194: Application is not configured as a multi-tenant application. 
Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. 
Use a tenant-specific endpoint or configure the application to be multi-tenant.

How to reference plugin from typescript

Hi there! First of all, thank you for this plugin,

I am having trouble running this code:

        window.cordova.plugins.msalPlugin.msalInit(function() {
            // Success logic goes here
        },
        function (err) {
            // err has your exception message
        }, {});

It tells me

Property 'cordova' does not exist on type 'Window'.

I have tried to just omit window, and then import cordova like:

import * as cordova from 'cordova';

But it really doesn't seem to like that, what am I doing wrong here? Thank you!

Any chance of an Ionic Capacitor version of this plugin?

Hi Walter, first of all, thank you for this great plugin. I've managed to integrate it into a capacitor project, manually changing the required variables (clientId, Android SHA1, tenant, etc.). Even though it works great, this means we have to "re-wire" every time there is a local npm install, but we have not found a way to replace the variables when using CI/CD. So when the CI/CD pipelines issues an "nom install", it resets the variables to the defaults.

Is there any chance to have a capacitor version of the plugin? Or is there a way to provide the variables in a json file (or alike), other than providing those values at the cli (cordova plugin add cordova-plugin-msal --variable TENANT_ID=your-tenant-guid-here --variable CLIENT_ID=your-client-guid-here --variable KEY_HASH=S0m3K3yh4shH3re=)?

Best regards, Ariel

device id is not passed to Azure AD with MS Intune (error we are getting error Set Up your device to get access)

Hi All,

I'm having some issues trying to authenticate my users via the Microsoft Intune app. The problem is that even though the users have complaint device on the Intune app, every time that they try to sign in they are still prompt to install the Intune app as if the app was completely unable to communicate with Intune and verify that the user actually has all the permissions required to go through.

We have verified back end azure logs, device id is missing in the request & it is hitting the conditional access policy and making the sign-in/device un-trusted device.

Please find configurations as below
{
authorities: [
{
type: 'AAD',
audience: 'AzureADMyOrg',
authorityUrl: 'https://login.microsoftonline.com/TENENT_ID',
default: true
}
],
scopes: ['CLIENT_ID/.default'],
authorizationUserAgent: 'WEBVIEW'
}

image

Thanks in Advance !!

When building an Ionic solution, the android build fails stating it has duplicate classes

Hi,

I've tried to integrate your plugin in a small test project, and when creating an android build it fails with the following message:

* What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Program type already present: com.nimbusds.jose.AlgorithmFamily Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

I tried to skip the line in the build.gradle so it doesn't copy the 'nimbus-jose-jwt' library during build, but I suspect this is required in order for the msal plugin to function?

Any help would be much appreciated.

Sign in shows null

on signing in, on the username field it shows "null"

image

also noticed that on the url for signing in there is a querystring "&login_hint=null" are we missing something in the configuration so that null will not appear?

Supplying CLIENT_ID at runtime

Is it possible to not supply the CLIENT_ID when adding the plugin but rather at runtime when the plugin is initialised? Our app needs the ability to link to a clients own azure tenant, which cannot be supplied at development time.

how to implement?

Hello,

I have a two implementation questions, that I ca not get clear from the documentation.
If we run the Cordova app with the plugin on an Android device:

  • should we also include the MSAL.java library or not?
  • does it work with MS Authenticator? If so, what should we choose as redirect uri. For our Xamarin apps on Android we have the package name+signing hash format to work correctly with authenticator.

regards,

Harm

Dynamic Tenant ID

Is there any to use an dynamic tenant ID? As far as i have seen in the code the tenant id will always be from the package.json config and cannot be set on init.

The problem:
Our app gets used by different companies, those can enable azure login where they provide the tenant id. So we dont know the tenant id before and therefore we need to set it in the code behind.

I modified the MsalPlugin to check for an tenant id in the authorities and use that if specified otherwise use the config tenant id (Which in my case would be common because its not specified).

If you see any added value in this feature, let me know and i will open an PR for it.

How to Add Multiple Scopes on the var options = {scopes:['']}

Hi I am currently integrating azure AD to a cordova mobile application with angularJS framework. I am able to successfully implement it with one scope, but I am encountering issues on adding another one.

options = {scopes:['scope1', 'scope2']}

can you please help us with this? thank you.

signInSilent/signInInteractive returning only token, not the response as documented

Hello:

Your documentation is very clear regarding the Response we should expect from successful calls to both signIn[Silent|Interactively]:
{
token: 'eyJ0eXAiOiJKV1QiLCJub...',
account: {
id: 'abc-someguid-123',
username: '[email protected]',
claims: [
{key: "name", value: "Robins, Walter"},
{key: "ver", value: "2.0"},
{ ... }
]
}
}

However, I am only seeing the token (what appears to be a token anyway). Not an JSON object.

Can you please assist?

Thank you

No such file or directory, open 'platforms/browser/browser.json'

Hello, please help solve this issue:

[2021-12-30T06:53:31.907Z] [ERROR] [Build] ENOENT: no such file or directory, open 'platforms/browser/browser.json'
[2021-12-30T06:53:31.907Z] [ERROR] [Build] Build failed with the following error: Something happened on our side while generating your app. Please try again.

I cannot build .apk file in Outsystems with latest master branch.

BR, Kirill

Is user_impersonation scope supported?

Hi,

I wanted to use this plugin for our mobile app authentication but our REST service is old and is based on a V1.0 endpoint. With that our app AD registration have the API permission user_impersonation but it is in a different resource/scope.
Screen Shot 2020-04-29 at 1 41 14 PM

So tried adding a scope to the scopes option:

scopes: ['User.Read', 'user_impersonation']

but that didn't work.

I did a bit of research and found that MSAL can be used to communicate and generate a V1.0 token with the permission https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-v1-app-scopes

Will this be supported in the future for this plugin?

return id_token

is there a way to return id_token ?
using implicit flow I managed to get that by adding response_type = "id_token token" so it will return both access and id tokens.

Redirect back to app not working

Hello,
I am running my application locally and testing it on a emulator.
I am running into an issue where after the authentication I am not able to redirect back to my application.
I have added http://localhost to replyURL's on the azure portal.
Your quick response would be much appreciated .
Thanks

Subfields of authorities does not inherit from defaults

The options parameter object has some default values, but if you pass an incomplete object to the authorities array, it will not inherit from the default values and will fail silently.

const options: any = { authorities: [ { type: 'B2C', authorityUrl: '<placeholder>' } ] };

The json provided above does not have the audience entry, I would expect this to be filled automatically.

brokerRedirectUri

Hi, I set brokerRedirectUri to true, but nothing happened, the success nor fail callbacks did not trigger. if it is set to false, everything works fine.

I installed the plugin as indicated.

Here are my options
authorities: [ { type: 'AAD', audience: 'AzureADMyOrg', authorityUrl: '', cloudInstance: 'MSALAzurePublicCloudInstance', default: true } ], prompt: 'SELECT_ACCOUNT', authorizationUserAgent: 'WEBVIEW', accountMode: 'SINGLE', brokerRedirectUri: true, scopes: [ 'openid', 'profile' ]

I had set up my application on Azure portal and installed MSAuthenticator on my Android device as well.

Getting Installation error in iOS platform

Hello,
When I try to install the MSAL plugin in my Cordova app I get an error.

Installing "cordova-plugin-msal" for ios
Failed to install 'cordova-plugin-msal': undefined
CordovaError: Promise rejected with non-error: '/bin/sh: /usr/local/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory\n'
at /usr/local/lib/node_modules/cordova/bin/cordova:29:15
at processTicksAndRejections (internal/process/task_queues.js:97:5)

Cordova info:
[email protected] with:
[email protected]
[email protected]
[email protected]
[email protected]

Environment:
OS: darwin
Node: v12.16.1
npm: 6.13.4

iOS platform:
Xcode 12.0.1
Build version 12A7300

Please help me.:)

signInSilent method randomly returns an array instead of an object

Hi, I've created an Android Cordova app based on an Angular 11 SPA. I am calling the signInSilent method from my SPA's HttpInterceptor to get a token to pass to my API. This usually works normally the first time, but then it starts randomly giving me an array as a response when invoked.

This is my configuration (I removed the API ID):

{
    authorities: [
      {
          type: 'AAD',
          audience: 'AzureADMyOrg',
          authorityUrl: '',
          cloudInstance: 'MSALAzurePublicCloudInstance',
          default: true
      }
    ],
    authorizationUserAgent: 'DEFAULT',
    multipleCloudsSupported: false,
    brokerRedirectUri: false,
    accountMode: 'SINGLE',
    scopes: ['api://00000000-0000-0000-0000-000000000000/access_api'],
    otherScopesToAuthorize: [
      'User.Read'
    ]
  }

Normally I get this kind of result:

{
    "token":"eyJ0eX000000...",
    "account":{
        "id":"00000000-0000-0000-0000-000000000000",
        "username":"Missing from the token response",
        "claims":[]
    }
}

But then I randomly also receive this result:

[
    {
        "id":"00000000-0000-0000-0000-000000000000",
        "username":"Missing from the token response",
        "claims":[]
    }
]

As you can see, first, it doesn't have a token; second, it is an array.

I keep my own cache of the token, so this is not a problem during the time that the token is valid, but as soon as it expires, if the next API call receives the array result, I end up passing the cached expired token to the API, and of course get a 401 Unauthorized error.

The most bizarre thing about this error is that when debugging the Java code using Android Studio, I noticed that the array result is being passed to my app's JavaScript callback, before the native code is invoked. So the native code produces the right authorization object, but it never gets to the app because the callback has already been triggered.

Has anyone experienced this error, and/or knows how I can solve it? Any ideas are welcome.

Thank you for your attention, and for this great library!

Cannot find MSAL/Msal.H

Hello, having some issues when used this plugin. I cannot run on Xcode saying that MSAL/Msal.h is not found on the import. Thanks!

preference value not resolving but set in package.json

Hi there,

I'm getting the following issue and my thinking is that for some reason the preference values are not resolving:
Sign-in error

image

(in case the image doesn't show)
Application with identifier '$CLIENT_ID' was not found in the directory 'myDirectory'

I successfully get directed to Azure.
I then submit my credentials.
I then get the above error.

Android config.xml

<feature name="MsalPlugin">
  <param name="ios-package" value="MsalPlugin"/>
  <param name="onload" value="true"/>
  <preference name="tenantId" value="$TENANT_ID"/>
  <preference name="clientId" value="$CLIENT_ID"/>
</feature>

iOS config.xml

  <feature name="MsalPlugin">
    <param name="ios-package" value="MsalPlugin"/>
    <param name="onload" value="true"/>
    <preference name="tenantId" value="$TENANT_ID"/>
    <preference name="clientId" value="$CLIENT_ID"/>
  </feature>

package.json

  "cordova": {
    "plugins": {
      "cordova-plugin-msal": {
        "TENANT_ID": "XxxxXXXXXXxx",
        "CLIENT_ID": "YYYyyyyYYYy",
        "KEY_HASH": "hash=" 
      }
    }
  }

Any help would be really appreciated thanks!

Can i integrate custom B2C login page?

Hi,

I am creating a Cordova iOS app. I tried to use the below options,

var options = {
                authorities: [{
                    type: 'B2C',
                    authorityUrl: 'https://url.b2clogin.com/url.onmicrosoft.com/B2C_1_endpoint2',
                }],
                scopes: ["https://yyy.onmicrosoft.com/B2CAPI/openid", "https://yyy.onmicrosoft.com/B2CAPI/read", "https://yyy.onmicrosoft.com/B2CAPI/user_impersonation"],
            }

Upon triggering signInInteractive I am getting the default Microsoft login screen.

Also is there way i can give redirect URL for iOS app like msauth.com.bundle.mobileapp://auth and the cache location as localstorage similar to the options in msal.js?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.