I have correctly whitelisted my domain as instructed, I have properly configured on the app the network to be sapphire_devnet and my own client ID, same as on the dashboard but still get this error. I am simply trying to use the given iOS example code locally to try out the SDK. I have seen similar posts and followed the solutions, but haven’t been able to fix this. I have tried creating new projects on testnet instead and still get to the same issue. I am still new to the SDK and iOS, any help would be appreciated.
- SDK Version: 8.1.0
- Platform: iOS
- Browser Console Screenshots:
My code, taken from the example code on GitHub:
import Foundation
import Web3Auth
class ViewModel: ObservableObject {
var web3Auth: Web3Auth?
@Published var loggedIn: Bool = false
@Published var user: Web3AuthState?
@Published var isLoading = false
@Published var navigationTitle: String = ""
private var clientId = "BP9CvuBjgOrYv-E3soGrZFQfyR7nwMqxvPJrdsR8qD2e5ypW_nlOW-KIaaiqkjJmIQbrihtHMMO2ViBvHsIO0pot"
private var network: Network = .sapphire_devnet
func setup() async {
guard web3Auth == nil else { return }
await MainActor.run(body: {
isLoading = true
navigationTitle = "Loading"
})
web3Auth = await Web3Auth(W3AInitParams(
clientId: clientId, network: network
))
await MainActor.run(body: {
if self.web3Auth?.state != nil {
user = web3Auth?.state
loggedIn = true
}
isLoading = false
navigationTitle = loggedIn ? "UserInfo" : "SignIn"
})
}
func login(provider: Web3AuthProvider) {
Task {
do {
let result = try await web3Auth?.login(
W3ALoginParams(loginProvider: provider)
)
await MainActor.run(body: {
user = result
loggedIn = true
})
} catch {
print("Error")
}
}
}