Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: newRefreshTokenArray is not iterable #1

Closed
dsclassen opened this issue Jan 6, 2023 · 1 comment
Closed

TypeError: newRefreshTokenArray is not iterable #1

dsclassen opened this issue Jan 6, 2023 · 1 comment

Comments

@dsclassen
Copy link

Hello. I am trying to manually test the auth route (http://localhost:3500/auth) using Thunder Client. and I'm getting the following error:

POST /auth
cookie available at login: {}
/refresh_token_rotation/controllers/authController.js:67
        foundUser.refreshToken = [...newRefreshTokenArray, newRefreshToken];
                                     ^

TypeError: newRefreshTokenArray is not iterable
    at handleLogin (/refresh_token_rotation/controllers/authController.js:67:38)

Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...

It appears to be happening here:

        // Saving refreshToken with current user
        foundUser.refreshToken = [...newRefreshTokenArray, newRefreshToken];
        const result = await foundUser.save();
        console.log(result);
        console.log(roles);
@dsclassen
Copy link
Author

Ahhh I see. I was testing with an old User model with:

refreshToken: String

which I needed to update to:

refreshToken: [String]

closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant