Adding the ZenKey Button on iOS

To add the ZenKey button to your application’s UI, create an instance of ZenKeyAuthorizeButton and add it to your UIView. Set a delegate to handle authorization.

import ZenKeySDK

class LoginViewController {
    let zenKeyButton = ZenKeyAuthorizeButton()

    override func viewDidLoad() {
        super.viewDidLoad()

        let scopes: [Scope] = [.openid, {desiredScope1}, {desiredScope2}, etc.]
        // Besides .openid, all scopes are optional. Please include only those scopes you truly need.

        zenKeyButton.scopes = scopes
        zenKeyButton.delegate = self

        view.addSubview(zenKeyButton)
    }
}

Add a dark color button on iOS

The button's appearance is customizable. The ZenKey button uses the dark style by default. The dark button style looks like this:

Add a light color button on iOS

You can change the style by setting the button's style property as follows:

    zenKeyButton.style = .light

The light button style looks like this:

Create a custom button on iOS

🚧

Custom button requirements

Custom buttons must meet the ZenKey brand integration guidelines to be approved for use. Read more about button requirements here.

Instead of the default ZenKeyAuthorizeButton, invoke ZenKey with your own custom button or view (for example, if your login UX is presented in a WebView). See the implementation details in perform a manual authorization request.

📘

More information available at GitHub:

https://github.com/MyZenKey/sp-sdk-ios


Did this page help you?