Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
IAM authentication support (#27)
Browse files Browse the repository at this point in the history
* adding handlebars for starterkit

* removing appledevelopment tenant

* adding back appledevelopment

* adding back appledevelopment

* adding support for IAM authentication

* updating comment
  • Loading branch information
Christian Compton authored and stevemart committed Jun 12, 2018
1 parent 2dad37e commit d3cae5e
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions ios_swift/ResumeARStarter/ViewController.swift
Expand Up @@ -151,16 +151,29 @@ class ViewController: UIViewController, ARSCNViewDelegate {
return
}

// Retrieve credentials
guard let vrApiKey = credentials["visualrecognitionApi_key"] as? String, !vrApiKey.isEmpty,
let url = credentials["cloudantUrl"] as? String, !url.isEmpty else {
// Retrieve Cloudant credentials
guard let url = credentials["cloudantUrl"] as? String, !url.isEmpty else {
return
}

self.visualRecognition = VisualRecognition.init(apiKey: vrApiKey, version: self.VERSION)
// Set the Watson credentials for Visual Recognition service from the BMSCredentials.plist
// If using IAM authentication
if let apiKey = credentials["visualrecognitionApikey"] as? String {

// Create service sdks
self.visualRecognition = VisualRecognition(version: self.VERSION, apiKey: apiKey)

// Else for legacy api_key authentication
} else {
guard let apiKey = credentials["visualrecognitionApi_key"] as? String else {
return
}
// Create service sdks
self.visualRecognition = VisualRecognition.init(apiKey: apiKey, version: self.VERSION)
}

self.cloudantRestCall = CloudantRESTCall.init(cloudantUrl: url)
self.cloudantRestCall?.database = Constant.databaseName

}

override func viewWillAppear(_ animated: Bool) {
Expand Down

0 comments on commit d3cae5e

Please sign in to comment.