menu arrow_back close search On Github

Set up

  1. Home
  2. iOS SDK integration
  3. Set up

Add dependency

Add pod 'TDConnectIosSdk' to your Podfile and run $ pod install.

Add URL Scheme to Info.plist

 URL Scheme to Info.plist

Handle notification in AppDelegate

AppDelegate.swift

// ...
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    let notification = Notification(name: Notification.Name(rawValue: AGAppLaunchedWithURLNotification), object:nil, userInfo:[UIApplication.LaunchOptionsKey.url:url])
    NotificationCenter.default.post(notification)
    return true
}

Add config and instantiate Oauth2Module

// We need an instance of Oauth2Module, and to get that we first need a config
let config = TelenorConnectConfig(clientId: "telenordigital-connectexample-ios",
    redirectUrl: "telenordigital-connectexample-ios://oauth2callback",
    useStaging: true,
    scopes: ["profile", "openid", "email"],
    accountId: "telenor-connect-ios-hello-world",
    webView: false,
    optionalParams: ["ui_locales": "no"])

// Instantiate oauth2Module
let oauth2Module = AccountManager.getAccountBy(config: config) ?? AccountManager.addAccountWith(config: self.config, moduleClass: TelenorConnectOAuth2Module.self)
Edit this page