any way for Custom Error Messsage
i have two doubt
- i got the point of implementing all the functions but where function getAccessToken and getRefreshToken utilized or called ?? i get the point from your comment How to implement. 2.when ever i pass an error in any function like
model.saveAccessToken = function (accessToken, clientId, userId, expires, callback) {
callback({'error':'invalid response'},false);
};
then it will give the response { code: 503 error: "server_error" error_description: "server_error" } if there is any custom mistake or error then can i change this response to some thing else manually .can i customize error message using this library??
On the whole, no, you can't create custom errors. This is to encourage compliance with the spec, if you can show me a good example of where a custom error would be useful I would consider implementing it for 2.0.
However, you can invoke error responses based on what you return from the model methods. For example, if you return something falsey from getAccessToken this will invoke a "invalid_token" response.
In your example, saveAccessToken, i'm not sure why you would want to pass in a custom error there?
Closing as no example of where a custom error would be useful
old issue but i have a case - maybe you can provide a quick workaround.
I use JWT which required me to rewrite the model.getAccessToken implementation. I use a try/catch block to decode the JTW. If it fails this is usually due to a decoding error, and hence a "invalid_token" error. However it produces a "server_error" - any suggestions?
Any updates on this? Being able to create custom messages would be more easier for a lazy ass like me. :smile: