Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UID2ApiUrl</key>
<string>https://operator-integ.uidapi.com</string>
</dict>
<dict/>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ class RootViewModel: ObservableObject {

init() {
UID2Settings.shared.isLoggingEnabled = true

// Only the development app should use the integration environment.
// If you have copied the dev app for testing, you probably want to use the default
// environment, which is production.
if Bundle.main.bundleIdentifier == "com.uid2.UID2SDKDevelopmentApp" {
UID2Settings.shared.environment = .custom(url: URL(string: "https://operator-integ.uidapi.com")!)
}

Task {
await UID2Manager.shared.$identity
.receive(on: DispatchQueue.main)
Expand Down
6 changes: 3 additions & 3 deletions Sources/UID2/UID2Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import Foundation
@preconcurrency import OSLog

internal final class UID2Client: Sendable {

static let defaultBaseURL = URL(string: "https://prod.uidapi.com")!

private let clientVersion: String
private let environment: Environment
private let session: NetworkSession
Expand Down Expand Up @@ -125,6 +122,9 @@ internal final class UID2Client: Sendable {
let statusCode = response.statusCode
let responseText = String(data: data, encoding: .utf8) ?? "<none>"
os_log("Request failure (%d) %@", log: log, type: .error, statusCode, responseText)
if environment != .production {
os_log("Failed request is using non-production API endpoint %@, is this intentional?", log: log, type: .error, baseURL.description)
}
throw TokenGenerationError.requestFailure(
httpStatusCode: statusCode,
response: responseText
Expand Down