Closed luncht1me closed 7 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed due to continued inactivity. Thank you for your understanding. If you believe this to be in error, please contact one of the code owners, listed in the CODEOWNERS
file at the top-level of this repository.
I need some serious help here.
I have a problem, where I'm trying to link an OpenID to my user account.
It works fine, but thing is, I can then sign in as a different user and link that same OpenID account.
There is no validation or checking that a UserCredential is already linked with the same externalId to a different userId.
So, my thought was, why not just do
userCredentialModel.validatesUniquenessOf('externalId', {message: "externalId already exists"});
?Turns out, this works fine, internally. Thing is, I'm not getting this error exposed up to my application. When I use a
validatesUniquenessOf
on any model elsewhere in the site, when the validation catches the error I can see the response both in my console and in my error handling for the application.Spent hours and hours digging today on how to get this error, which passport sees (I can log it in component-passport's
lib/models/user-credential.js
by changing the callback at the end of theuserCredentialModel.create
to beThe console log shows the loopback validation error object as expected. But, even though it's passed into the callback here, it never appears within the application itself. I need to write some application logic around this validation error. But how can I if it's never bubbled back up to the server? It just seems to disappear silently inside the passport. The other thing is, my application does redirect to the
failureRedirect
url defined in my provider, but there's just no response data that I can find.The
res.statusCode
is null, like the error is literally just ignored and we're passed on to the redirectUrl with no information as to why.How am I supposed to handle this?? Why isn't the error exposed to the application, even though I'm using loopback-native validation on the model.