Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

How to properly fill scope variable?!?! #17

Closed
cignum opened this issue Jul 17, 2017 · 1 comment
Closed

How to properly fill scope variable?!?! #17

cignum opened this issue Jul 17, 2017 · 1 comment

Comments

@cignum
Copy link

cignum commented Jul 17, 2017

Hello,
I am trying reproduce this sample with an ApiApp I developed.

I cannot face how to properly set the variables below:

//API url
var apiURL = 'https://fabrikamb2chello.azurewebsites.net/hello';
var scope = 'openid https://fabrikamb2c.onmicrosoft.com/demoapi/demo.read';

I guess apiURL is the url is the actual address of where the aPI is published, and that's pretty clear.

I totally cannot understand how to set the "scope" variable above: my guess is that "https://fabrikamb2c.onmicrosoft.com/demoapi/" is the appID URI of the ApiAPP, but this is not explained in the article, and also I don't understand where demo.read comes from, and the role of the leading openid word.

Please help.

Thanks :)

@cignum
Copy link
Author

cignum commented Jul 17, 2017

Ok I figured it out by following this post:
https://azure.microsoft.com/en-us/blog/azure-ad-b2c-access-tokens-now-in-public-preview/

The explanation:
var scope = 'openid https://fabrikamb2c.onmicrosoft.com/demoapi/demo.read';
is a space-separated string of scopes.
"openid" is needed, as far as I understood, to get the ID_Token
the second part is the concatenation of the AppID URI of the ApiAPP and the scope VALUE, in this case a scope is created with value "demo.read" in the apiapp application configuration.

@cignum cignum closed this as completed Jul 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant