Hi I am facing an issue when triggering the tapkey lock it scans for the lock and successfully scans it. The when I trigger unlcok againsat the PhysicalLockId I get the lock blinks red and I get message Unauthorized.
Using Token Exchange Mechanism, generated Identity provider against Oauth Client. The lock is assigned to the user as unrestricted
iOS trigger Lock Function
private func triggerLock(physicalLockId: String) -> TKMPromise<Bool> {
guard let bluetoothAddress = self.bleLockScanner.getLock(
physicalLockId: physicalLockId)?.bluetoothAddress else {
self.showAlert(title: "Alert", message: "Lock not nearby", okTitle: R.string.localizable.commonCancel(), cancelString: R.string.localizable.commonScanAgain(), cancelHandle: { _ in
self.scanLock()
})
return TKMAsync.promiseFromResult(false)
}
let ct = TKMCancellationTokens.fromTimeout(timeoutMs: 15000)
// Use the BLE lock communicator to send a command to the lock
return self.bleLockCommunicator.executeCommandAsync(
bluetoothAddress: bluetoothAddress,
physicalLockId: physicalLockId,
commandFunc: { tlcpConnection -> TKMPromise<TKMCommandResult> in
let triggerLockCommand = TKMDefaultTriggerLockCommandBuilder()
.build()
// Pass the TLCP connection to the command execution facade
return self.commandExecutionFacade!.executeStandardCommandAsync(tlcpConnection, command: triggerLockCommand, cancellationToken: ct)
},
cancellationToken: ct)
// Process the command's result
.continueOnUi({ commandResult in
let code: TKMCommandResult.TKMCommandResultCode = commandResult?.code ??
TKMCommandResult.TKMCommandResultCode.technicalError
switch code {
case TKMCommandResult.TKMCommandResultCode.ok:
return true
default:
return false
}
})
.catchOnUi({ (_: TKMAsyncError) -> Bool in
NSLog("Trigger lock failed")
self.showAlert(title: "Alert", message: "Trigger lock failed")
return false
})
}