a-crash-course-on-serverless-auth
a-crash-course-on-serverless-auth copied to clipboard
Callback in verifyToken
In verfyToken.js i believe the correct would be:
return callback('Unauthorized', null);
and not:
return callback(null, 'Unauthorized');
The first param in the callback
function is reserved for Error objects. If you want to be meticulous and pass in an Error that specifies the issue then you could do:
return callback(new Error('Unauthorized'), 'Unauthorized')
However, this will label it as an error in the 500 range. Which is not really what we'd want here. It should be a 401 error. What you could do is create a custom HTTP response and send a 401 status code response to the client. :smile: