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

How to switch policies ? #68

Open HristoStoevZ opened 3 years ago

HristoStoevZ commented 3 years ago

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.

orjandh commented 3 years ago

I also think this is needed. I started working on this in a new branch https://github.com/orjandh/cordova-plugin-msal/tree/switch_policy. It seems to work and lets me specify which policy I would like to run. My change is currently only scoped to Android and single user mode.

I don't know what would be the best interface for this. Maybe what we actually want is a new function that can run any policy instead of providing a policy to signInInteractive, because this could be more than just a sign in. I would probably also need some help with the iOS programming.

I hope this can be incorporated into the plugin eventually. :)

peitschie commented 2 years ago

@wrobins out of interest, is something like this on your radar still? If I raised a PR based off @orjandh and did some testing and such, is there a possibility we could land a feature like this in master?

I'm asking as one of the applications I support is about to require this capability, and I'd love to get it mainlined if possible 😃