Azure-Samples / ms-identity-mobile-apple-swift-objc

An iOS sample in Swift that authenticates Microsoft Account and Azure AD users and calls the Graph API using OAuth 2.0
https://aka.ms/aaddev
74 stars 37 forks source link

Update to do AcquireTokenSilent first #4

Closed bbjwerner closed 7 years ago

bbjwerner commented 7 years ago

Updated the code to do AcquireTokenSilent() first and then AcquireToken() if that fails. This is the pattern that .Net uses and we've been requested to use as well.

The pattern in .Net requires an interactionRequired MSALError to be thrown if the User object is nil, which doesn't happen in iOS library currently. To get around this for now I throw my own MSALError with ErrorCode.interactionRequired

msftclas commented 7 years ago

@brandwe, Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA. Thanks, Microsoft Pull Request Bot