Skip to content

Commit

Permalink
fixed an error
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPlayGamez committed Oct 2, 2024
1 parent d2a40a1 commit 79e94e9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# Seamless-Auth
# Seamless-auth

A versatile and secure authentication module for Node.js applications.


## DEPRECATED

> **Warning**
> TO GET UPDATES AND FUTURE PROOFING, please use `seamless-auth` package




Expand Down
3 changes: 2 additions & 1 deletion file.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ class Authenticator {
async verifyToken(token) {
if (jwt.verify(token, this.JWT_SECRET_KEY, this.JWT_OPTIONS)) {
let jwt_token = jwt.decode(token);
return (this.getInfoFromUser(jwt_token._id).version == jwt_token.version) ? this.getInfoFromUser(jwt_token._id) : false;
let user = await this.getInfoFromUser(jwt_token._id)
return (user.jwt_version === jwt_token.version) ? this.getInfoFromUser(jwt_token._id) : false;
}
}
async verify2FA(userId, twofactorcode) {
Expand Down
3 changes: 2 additions & 1 deletion memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ class Authenticator {
async verifyToken(token) {
if (jwt.verify(token, this.JWT_SECRET_KEY, this.JWT_OPTIONS)) {
let jwt_token = jwt.decode(token);
return (this.getInfoFromUser(jwt_token._id).version == jwt_token.version) ? this.getInfoFromUser(jwt_token._id) : false;
let user = await this.getInfoFromUser(jwt_token._id)
return (user.jwt_version === jwt_token.version) ? this.getInfoFromUser(jwt_token._id) : false;
}
}
async verify2FA(userId, twofactorcode) {
Expand Down
7 changes: 6 additions & 1 deletion mongodb.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,15 @@ class Authenticator {
}

async verifyToken(token) {

try {

if (jwt.verify(token, this.JWT_SECRET_KEY, this.JWT_OPTIONS)) {
let jwt_token = jwt.decode(token);
return (this.getInfoFromUser(jwt_token._id).version == jwt_token.version) ? this.getInfoFromUser(jwt_token._id) : false;
let user = await this.getInfoFromUser(jwt_token.id)
console.log("user")
console.log(user)
return (user.jwt_version === jwt_token.version) ? this.getInfoFromUser(jwt_token._id) : false;
}
} catch (error) {
console.log(error)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "seamless-auth",
"version": "3.7.5",
"version": "3.7.6",
"description": "A full fledged authentication system...",
"type": "commonjs",
"main": "memory.js",
Expand Down

0 comments on commit 79e94e9

Please sign in to comment.