Comment on page

iOS Demo Showcase

Demo example of integrating HyperID into an iOS application
Apple's URLSessionDataTask is the powerful and versatile framework that simplifies communication with external APIs, including the HyperID REST API.
Developers can explore the comprehensive Interactive Web Demo that provides an in-depth understanding of each HTTP request and its corresponding response structures. URLSessionDataTask can handle identical requests.
Incorporating authorization flows that require interactions with a browser component is another important task for developers when integrating HyperID. As part of the demo, developers will have the opportunity to explore two different approaches (please see the detailed explanation here):
  1. 1.
    Using an external browser.
  2. 2.
    Using an internal WKWebView class (from LoginWithWebView function).

Exploring Source Code

The source code is available on GitHub:
The ViewController.swift file contains the essential source code for handling authorization, with multiple classes that are critical to the process, including:
  • The eBrowser class facilitates the initiation of an external browser dedicated to the authorization flow. It is essential to ensure that all parameters are properly URL-encoded.
  • The eRedirectUriListener class is implemented to monitor and capture the redirect_uri callback.
  • The eConst class encompasses configuration constants such as clientID, client_secret, and redirect_uri. To facilitate testing and integration, developers can register their own Client via the HyperID Developer's Portal and utilize their individual credentials.
When using a custom clientID/clientSecret, it is important to ensure that the configured redirect URI is also registered through the HyperID Developer's Portal. This step is required to ensure successful integration.

Configuring Redirect URI Processing

To configure redirect URI processing on iOS, deeplinks are utilized.
The handling of callbacks is done in the HandleDeepLink(notification: Notification) function.
Developers can configure the deeplink in the Info.plist file or through the xCode configuration: