internal static async Task <MobileConnectStatus> RequestIdentity(IIdentityService _identity, DiscoveryResponse discoveryResponse, string accessToken, MobileConnectConfig _config, MobileConnectRequestOptions options) { string identityUrl = discoveryResponse?.OperatorUrls?.PremiumInfoUrl; var notSupported = IsSupported(identityUrl, "Identity", discoveryResponse?.ProviderMetadata?.Issuer); if (notSupported != null) { return(notSupported); } try { var response = await _identity.RequestIdentity(identityUrl, accessToken); return(MobileConnectStatus.Identity(response)); } catch (MobileConnectInvalidArgumentException e) { Log.Error(() => $"An invalid argument was passed to RequestIdentity arg={e.Argument}"); return(MobileConnectStatus.Error(ErrorCodes.InvalidArgument, string.Format("An argument was found to be invalid during the process. The argument was {0}.", e.Argument), e)); } catch (MobileConnectEndpointHttpException e) { Log.Error(() => $"A general http error occurred in RequestUserInfo identityUrl={identityUrl}"); return(MobileConnectStatus.Error(ErrorCodes.HttpFailure, "An HTTP failure occured while calling the operator token endpoint, the endpoint may be inaccessible", e)); } catch (Exception e) { Log.Error(() => $"A general error occurred in RequestUserInfo identityUrl={identityUrl}"); return(MobileConnectStatus.Error(ErrorCodes.Unknown, "A failure occured while requesting a token", e)); } }