简体   繁体   中英

How to connect Native iOS App <-> Azure B2C?

I am currently trying to connect Azure's B2C with a Native iOS Application. I have been able to get a Safari popup to return the email/id/response (using AppAuth), but I was looking to actually use an API to complete this while using native iOS elements, not a web page hosted by Microsoft which looks and feels tacky. Is there a better way to do this?

  NSURL *authorizationEndpoint = [NSURL URLWithString:[NSString stringWithFormat:kEndpoint, kTenantName, kSignupOrSigninPolicy, @"authorize"]];
    NSURL *tokenEndpoint = [NSURL URLWithString:[NSString stringWithFormat:kEndpoint, kTenantName, kSignupOrSigninPolicy, @"token"]];

    OIDServiceConfiguration *configuration = [[OIDServiceConfiguration alloc] initWithAuthorizationEndpoint:authorizationEndpoint tokenEndpoint:tokenEndpoint];

    OIDAuthorizationRequest *request = [[OIDAuthorizationRequest alloc] initWithConfiguration:configuration clientId:kClientId scopes:@[OIDScopeOpenID, OIDScopeProfile] redirectURL:[NSURL URLWithString:kRedirectUri] responseType:OIDResponseTypeCode additionalParameters:nil];

    currentAuthorizationFlow = [OIDAuthState authStateByPresentingAuthorizationRequest:request presentingViewController:presentingVC callback:callback];

At this time your only option is to customize the Azure AD B2C UI .

Creating your own native UIs requires the resource owner password credentials flow which Azure AD B2C does not yet support. You can vote for this feature ask in the Azure AD B2C feedback forum: Support the resource password credential flow .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM