ios - Firebase authentication tokens, check if valid -
is possible check if authentication token invalid?
firautherrorcode.errorcodeinvalidusertoken
this shown possible error can't figure out how access error besides when logging in or resetting password below.
firauth.auth()?.sendpasswordreset(withemail: email, completion: { (error) in if let err = error as? nserror { if let errorcode = firautherrorcode(rawvalue: err.code){ if errorcode == firautherrorcode.errorcodeinvalidusertoken{ self.alertfunc(title: "error", message: "invalid token") } } } else{ self.alertfunc(title: "success", message: "password reset email has been sent") }
if user has few devices logged same account, , reset password on one, others not able post firebase due invalid token. need apps on other devices able recognize invalid token , prompt user username , password.
any or links appreciated, thanks!
firauth.auth()?.currentuser?.gettokenwithcompletion({ (string, err) in if err != nil{ if let err = err nserror?{ if let error = firautherrorcode(rawvalue: err.code){ switch error{ case .errorcodeinvalidcredential: self.delegate.invalidtoken() case .errorcodeinvalidusertoken: self.delegate.invalidtoken() case .errorcodeusertokenexpired: self.delegate.invalidtoken() case .errorcodeinvalidcustomtoken: self.delegate.invalidtoken() case .errorcodecustomtokenmismatch: self.delegate.invalidtoken() default: print("call default error") } } } } })
Comments
Post a Comment