I carried out the Plaid configuration years in the past with the general public key. Every thing is working nice. Just lately Pliad requested us emigrate to Hyperlink token as an alternative of public key utilization since it’s deprecating.
So, I created a server-side perform to generate the hyperlink token and ship it to the app. Adopted the plaid doc to initialize the plaid configuration. In my case, the plaid interface just isn’t displaying with the hyperlink token. The progress is displaying for a second and instantly disappearing. However the Linktoken reveals the occasion as TRANSION_VIEW and OPEN. However I’m not seeing something—the identical web page displaying the plaid interface with the general public key. Beneath is my code
// Known as this methodology within the viewDidLoad
func LinkToken(){
let parameters: Parameters = [
"UserId":self.phoneno,
]
AF.request("https://us-central1-projectid.cloudfunctions.internet/PlaidLinkTokenGeneration/put up", methodology: .put up, parameters: parameters, encoding: JSONEncoding.default)
.validate(contentType: ["application/json"])
.responseJSON{ response in
let statuscode = response.response?.statusCode
change response.consequence{
case .success(let JSON):
if(statuscode == 200) {
let response = JSON as! NSDictionary
let TransId = response.object(forKey: "LinkToken")! as! String
print(TransId)
self.linkToken = TransId
self.createLinkHandler()
self.dismiss(animated: false, completion: nil)
UIApplication.shared.endIgnoringInteractionEvents()
}
else {
self.navigationController?.setNavigationBarHidden(false, animated: false)
self.dismiss(animated: false, completion: nil)
UIApplication.shared.endIgnoringInteractionEvents()
let response = JSON as! NSDictionary
}
case .failure(let error):
self.navigationController?.setNavigationBarHidden(false, animated: false)
print("Request Failed with error:(error)")
self.dismiss(animated: false, completion: nil)
UIApplication.shared.endIgnoringInteractionEvents()
_ = self.storyboard?.instantiateViewController(withIdentifier: "Funds")as! Funds
self.navigationController?.popViewController(animated: true)
}
}
}
personal func createLinkHandler() {
let configuration = createLinkTokenConfiguration()
print("configuration",configuration)
let consequence = Plaid.create(configuration)
change consequence {
case .failure(let error):
print("Unable to create Plaid handler attributable to: (error)")
case .success(let handler):
self.handler = handler
openLink()
}
}
personal func openLink() {
if let handler = handler {
handler.open(presentUsing: .viewController(self))
}
else{
print("Plaid handler just isn't obtainable. Hyperlink stream can't be began.")
}
}
personal func createLinkTokenConfiguration() -> LinkTokenConfiguration {
var linkConfiguration = LinkTokenConfiguration(token: linkToken) { success in
print("public-token: (success.publicToken) metadata: (success.metadata)")
}
linkConfiguration.onExit = { exit in
if let error = exit.error {
print("exit with (error)n(exit.metadata)")
} else {
// Consumer exited the stream with out an error.
print("exit with (exit.metadata)")
}
}
linkConfiguration.onEvent = { occasion in
print("Hyperlink Occasion: (occasion.eventName)")
// Listed here are the hyperlink occasion printing "TRANSISION_VIEW" and "OPEN"
}
return linkConfiguration
}
What am I lacking? Tried other ways. However nothing is working.