Hi ho. I’m trying to implement custom flow on mobile app for the user to update his email / password.
This is my auth code on iOS:
Auth0
.authentication()
.login(
usernameOrEmail: authData.email,
password: authData.password,
realm: Constants.emailConnection,
audience: "user-update",
scope: Constants.scope,
parameters: nil
)
.start { [weak self] result in
switch result {
case .success(let credentials):
_ = self?.credentialsManager.store(credentials: credentials)
completionHandler(.success(result: credentials))
case .failure(let error):
completionHandler(.failure(error: error))
}
}
And this is how I try to update the user data:
Auth0
.users(token: accessToken)
.patch(userInfo.sub, attributes: attributes)
.start { result in
switch result {
case .success:
completionHandler(.success(result: {}()))
case .failure(let error):
completionHandler(.failure(error: error))
}
}
The error I get when calling above method:
Fail: Failed with unknown error [“statusCode”: 401, “message”: Bad audience: user-update https://folt.auth0.com/userinfo, “error”: Unauthorized]
I’m lost… can’t figure out why I still getting that error. Any help?