mvertopoulos / vue-msal

Vue plugin for using Microsoft Authentication Library (MSAL)
MIT License
123 stars 66 forks source link

How to set policy (user flow)? #11

Closed ankur198 closed 4 years ago

ankur198 commented 4 years ago

it would be better to have options like


tenantConfig = {
        tenant: "hellowrold.onmicrosoft.com",
        clientID: '{ your-client-id }',
        signInPolicy: "B2C_1_signin",
        signUpPolicy: "B2C_1_signup",
        redirectUri:"http://localhost:4200",
        b2cScopes:["https://hellowrold.onmicrosoft.com/access-api/user_impersonation"]
 };
adomsodi commented 4 years ago

+1, B2C user flows should be configurable and I would welcome more control over the sign-in request parameters. Unfortunately, I have to fall back to native MSAL.

ddlaat commented 4 years ago

@adomsodi Configure it like this:

auth = {
  clientId: 'd2e486b0-4e06-42e0-9aaf-62054c032cf7',
  tenantId: '<your-tenant>.onmicrosoft.com/B2C_1_signup_signin', // <-- policy id
  tenantName: '<your-tenant>.b2clogin.com/tfp', // <-- TFP
  validateAuthority: false
}
mvertopoulos commented 4 years ago

Hi!

This has now been fixed with commit https://github.com/mvertopoulos/vue-msal/commit/7bf71601108a0c5de160b75d81336623685640a9.
It has also been released in npm version 3.1.0.

This makes the authority option available for use instead of the tenantId and tenantName options. To avoid braking changes the previous options tenantId and tenantName are also available in this version but they will be removed in next major version. To prepare for this change, existing users that want to upgrade to next major version (4.x.x) will need to replace:

{
  auth: {
    tenantName: '<YOUR_tenantName>',  // Default is 'login.microsoftonline.com'
    tenantId: '<YOUR_tenantId>'  // Default is 'common'
    //...
  }
}

with:

{
  auth: {
    authority: 'https://{tenantName}/{tenantId}' // Default is 'https://login.microsoftonline.com/common'
    //...
  }
}

Thanks for all of your inputs.