This repository contains a simple iOS project that integrates with Talkdesk SDK in order to run an interaction. It implements the application-specific part of the authorization mechanism of the SDK and can be used with the Talkdesk Mobile SDK Customer Authentication Service sample.
- Check out the Talkdesk Mobile SDK Customer Authentication Service sample and follow the instructions to run it locally using the account-specific OAuth client secrets provided by Talkdesk.
- Make sure you have the latest Xcode and Cocoapods installed. Check out the project and run
pod install
on the root folder. - Open SDKSample.xcworkspace and navigate to
AuthorizationController.swift
under the Service configuration mark. Fill the values for the Basic Auth username and password inauthorizationUsername
andauthorizationPassword
. - Update the
authorizationEndpoint
value accordingly if you have made changes to the Ruby Server Sample code that affect the endpoint it is running on. Replacelocalhost
with the machine's IP address if you intend to run it in a different device (rather than a simulator). - Run the app on a simulator or device and tap "Start Interaction". You should see the following message and screen:
-
If this is not what you are seeing, here is a quick troubleshooting checklist:
-
Is the server running and reachable? Make sure the Ruby Server Sample is running on the same network as your device or simulator. You can use a proxy such as Charles to make sure the request is being made and to verify its contents.
-
Does the server return a 201 status code? Check the logs of the Ruby Server Sample. Did it receive a request when you pressed the button? What status code did it respond with? If the status code is not 201, check the service configuration both on the Server Sample (
.env
) and app.
-
This example app is using the SDK's storyboard-based integration rather than programmatic integration.
If your account has different flows you want to try out, follow the steps described below to change the intention being used.
- Open Main.storyboard.
- Under the Interaction View Controller Scene, click on Interaction View Controller.
- Open the Identity Inspector tab.
- Under User Defined Runtime Attributes, change the value field of
intentionName
to the desired intention.
In the following diagram you can see how the authentication is performed and which components are involved.
For a production-grade application we recommend the more sophisticated but more secure implementation with push notifications.