Azure-Samples / active-directory-b2c-ios-swift-native-msal

An iOS sample in Swift that authenticates Azure AD B2C users and calls an API using OAuth 2.0
https://aka.ms/aadb2c
MIT License
45 stars 22 forks source link

How to configure kScope #48

Closed maro01507i closed 3 years ago

maro01507i commented 3 years ago

Hello,

I'm trying to use this example to use my API, but it seems that I'm unable to determine how to include the kScope into my project.

Currently the app is able to show the login interface, and the user is capable of login, but when the login button is pressed, an error ocurres, that is as follow:

%@ TID=163667 MSAL 1.1.10 iOS 14.3 [2021-01-26 13:58:05 - 4FDAEE00-DB49-4A39-B5B8-FDB88CDF4236] Creating Error with description: Authentication response received without expected accessToken %@ TID=163667 MSAL 1.1.10 iOS 14.3 [2021-01-26 13:58:05 - 4FDAEE00-DB49-4A39-B5B8-FDB88CDF4236] Unsuccessful token response, error MaskedError(MSIDErrorDomain, -51100) %@ TID=163667 MSAL 1.1.10 iOS 14.3 [2021-01-26 13:58:05 - 4FDAEE00-DB49-4A39-B5B8-FDB88CDF4236] [MSAL] Interactive flow finished. Result (null), error: -51100 error domain: MSIDErrorDomain

I'm pretty sure that this error comes due to the fact that I'm not adding a kScope into the parameters (currently the kScope is with the default scope - the one that comes as example), but I'm not sure how to configure it. Could anyone explain to me how to configure the kScope?

antrix1989 commented 3 years ago

hi @maro01507i , seems you didn't get an Access token back from the server. To provide your scope, you can just modify the constant in the sample app, see here.

maro01507i commented 3 years ago

Hello @antrix1989 Yeah, I know that I need to change the scope in my project. The problem is that I don't know what data do I need to put in there. Could you point me to where that data is present in Azure to add it to the project?

antrix1989 commented 3 years ago

Hi @maro01507i , see here how to configure scopes.