I'm thoroughly mystified by the b2cScopes attribute which is used when instantiating the Microsoft Authentication Library in the B2C use case for ASP.NET Core 3.1. Here's the canonical example, where confusingly the sample code doesn't actually implement a helloapi or a demo api:
var appConfig = {
b2cScopes: ["https://fabrikamb2c.onmicrosoft.com/helloapi/demo.read"],
webApi: "https://fabrikamb2chello.azurewebsites.net/hello"
};
// instantiate MSAL
const myMSALObj = new Msal.UserAgentApplication(msalConfig);
But here are a bunch of other different formats for b2cScopes, such as:
Ex 1. source
b2cScopes: ["profile","email","openid", "https://lduceademo.onmicrosoft.com/big/read"]
Ex 2. source
b2cScopes: ["openid"]
Ex 3. source
b2cScopes: ['https://zzzzz.onmicrosoft.com/api/Hello.Read']
Ex 4. source
b2cScopes: 'https://meeblitenant.onmicrosoft.com/api/myapp_read',
'https://meeblitenant.onmicrosoft.com/api/myapp_write']
Ex 5. source
b2cScopes: ['https://my_app_name.onmicrosoft.com/my_api_name/user_impersonation email openid profile']
So I have the following questions:
- Do the .read and .write suffixes somehow map to HTTP GET, PUT, POST permissions? If not, what do these suffixes do?
- Is this value case insensitive (see Ex 3)?
- Some of the examples seem to imply a relative URL, and others imply a complete URL. Are both correct?
- Is Ex 5 just totally broken since it's using spaces to separate scopes instead of using a string array?
- If I've implemented a webapi at api/user that has both HTTP GET, PUT, and POST verbs, what should the b2cScope be?