I wanted to do Firebase Login using Phone Auth. As I am developing and I don't have an access to device & Apple developer account, so I went to implement this feature using
reCAPTCHA verification
but I get this following error
{"error":{"code":403,"message":"Requests from this ios client application are blocked.","errors":[{"message":"Requests from this ios client application are blocked.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}}
I have implemented that as it has been shown in the documentation.
Below is the code from AppDelegate.swift:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}
// For iOS 9+
func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
if Auth.auth().canHandle(url) {
return true
}
return false
// URL not auth related, developer should handle it.
}
Below is the code from ViewController.swift:
@IBAction func didTapSignUp(_ sender: Any) {
PhoneAuthProvider.provider().verifyPhoneNumber("+919637892151", uiDelegate: nil) { (verificationId, error) in
if let error = error {
// It always comes here
print(error.localizedDescription)
}
if let verificationId = verificationId {
print(verificationId)
UserDefaults.standard.set(verificationId, forKey: "authVerificationID")
}
}
}