spotny-sdk 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -254,7 +254,7 @@ public class SpotnyBeaconScanner: NSObject {
|
|
|
254
254
|
|
|
255
255
|
// Send token + apiKey + identifierId to backend — response returns a JWT used for all subsequent calls
|
|
256
256
|
// sdkToken is nil here so no Authorization header is injected on this call
|
|
257
|
-
let verifyPayload: [String: Any] = ["
|
|
257
|
+
let verifyPayload: [String: Any] = ["api_token": token, "api_key": key, "identifier_id": uid, "device_id": getDeviceId()]
|
|
258
258
|
post(endpoint: "\(apiBasePath)/verify", payload: verifyPayload) { [weak self] result in
|
|
259
259
|
guard let self = self else { return }
|
|
260
260
|
switch result {
|
|
@@ -262,7 +262,7 @@ public class SpotnyBeaconScanner: NSObject {
|
|
|
262
262
|
if 200...299 ~= status {
|
|
263
263
|
guard let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
|
|
264
264
|
let dataObj = json["data"] as? [String: Any],
|
|
265
|
-
let jwt = dataObj["
|
|
265
|
+
let jwt = dataObj["token"] as? String, !jwt.isEmpty else {
|
|
266
266
|
reject("VERIFY_FAILED", "SDK verification response missing JWT", nil)
|
|
267
267
|
return
|
|
268
268
|
}
|
|
@@ -500,7 +500,7 @@ public class SpotnyBeaconScanner: NSObject {
|
|
|
500
500
|
return
|
|
501
501
|
}
|
|
502
502
|
jwtRefreshInProgress = true
|
|
503
|
-
let refreshPayload: [String: Any] = ["
|
|
503
|
+
let refreshPayload: [String: Any] = ["api_token": credential, "api_key": key, "identifier_id": identifierId ?? "", "device_id": getDeviceId()]
|
|
504
504
|
performPost(endpoint: "\(apiBasePath)/verify", payload: refreshPayload) { [weak self] result in
|
|
505
505
|
guard let self = self else { return }
|
|
506
506
|
let flush: (Error?) -> Void = { err in
|
|
@@ -515,7 +515,7 @@ public class SpotnyBeaconScanner: NSObject {
|
|
|
515
515
|
if 200...299 ~= status,
|
|
516
516
|
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
|
|
517
517
|
let dataObj = json["data"] as? [String: Any],
|
|
518
|
-
let jwt = dataObj["
|
|
518
|
+
let jwt = dataObj["token"] as? String, !jwt.isEmpty {
|
|
519
519
|
self.sdkToken = jwt
|
|
520
520
|
if let ts = dataObj["expires_at"] as? Double {
|
|
521
521
|
self.sdkTokenExpiry = Date(timeIntervalSince1970: ts)
|