Setting Scopes for User Information on iOS

Set scopes for user information on iOS

There are several parameters to configure on your authorization button as noted in this section.

Select each of the user info scopes to add to the authorization request.

📘

The .openid scope is required.

    let scopes: [Scope] = [.openid, .email, .name, .phone, .postalCode]

For more info, see Scope.swift.

Additional Parameters

Other parameters to configure in your request include:

  • state - An optional variable passed during the discovery process and received along with the authorization code.

  • nonce - Any string whose value you provide in the authorization code request that will later be returned in the ID Token. The ID Token returns via the .openid scope from the authorization request and is the primary extension of the OAuth 2.0 spec that OpenID provides.

  • context - While context is not required for basic sign-in requests, if you wish to give users more information about an interaction, you may do so by submitting a string along with the authorization request. For example, a bank transfer may prompt the user: "Do you want to authorize a $200 transfer to your checking account?". Note that the maximum size for the context parameter is 280 characters. Larger strings result in an OIDC error (e.g. invalid_request).

  • acr_values - (Optional) The user authentication level to request from users.

    • a1: Use this authentication level if you require only low-level authentication for a user. Here, the user is not asked to provide their PIN or biometric data.
    • a2: Do not use this authentication level; it produces an inconsistent effect between carriers.
    • a3: (Default) Use this authentication level if you require the user to provide their PIN or biometric data. Here, the user provides their PIN or biometric data if they have not authenticated in the last 30 minutes or if prompt=login.

For more information about these parameters, view the documentation in ZenKeyAuthorizeButton.swift. There is also more information on the enumerated values in PromptValue.swift.

For information about consenting to share user scopes, visit Consenting to share user information .


Did this page help you?