Skip to content

Commit

Permalink
resolves #7 added token expired message if the jwt is expired
Browse files Browse the repository at this point in the history
  • Loading branch information
John Rodkey committed Apr 23, 2018
1 parent ab589dc commit 16f08c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-present, Mafe, Inc.
Copyright (c) 2017-present, WeWill3C, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -162,4 +162,8 @@ async function start() {
// Don't worry be hapi
start();
```
License MIT 2017

## Acknowledgement
This project is kindly sponsored by [Now IMS](https://nowims.com)

Licensed under [MIT](./LICENSE)
3 changes: 3 additions & 0 deletions lib/index.js
Expand Up @@ -126,6 +126,9 @@ internals.implementation = (server, options) => {
return true;
}
catch (error) {
if (error.name === 'TokenExpiredError') {
throw settings.unauthorized(`Invalid JWT: ${error.message} expiredAt: ${error.expiredAt}`);
}
if (keysTried >= settings.keychain.length) {
throw settings.unauthorized(`Invalid JWT: key or signature is invalid`, settings.tokenType);
}
Expand Down

0 comments on commit 16f08c1

Please sign in to comment.