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

User always displayed as authenticated, even if token expired #3980

Closed
1 task done
Ku3mi41 opened this issue Aug 15, 2023 · 3 comments
Closed
1 task done

User always displayed as authenticated, even if token expired #3980

Ku3mi41 opened this issue Aug 15, 2023 · 3 comments

Comments

@Ku3mi41
Copy link
Contributor

Ku3mi41 commented Aug 15, 2023

Your Environment

  • verdaccio version: 5.15.4
  • node version: 16.15.0
  • package manager: pnpm@6
  • os: windows@11
  • platform: npm

Describe the bug

Header menu shows user as authenticated even token is expired. Уou need to logout/login for view packages.

To Reproduce

  • Login
  • Wait for token expiration (1h by default)
  • Open verdaccio again / press F5, doesn't matter
  • Name on the screen and logout button, but no packages

Expected behavior

Display login button only if token expired. Because no packages will be visible anyway.

Screenshots, server logs, package manager log

image

Configuration File (cat ~/.config/verdaccio/config.yaml)

plugins: /verdaccio/plugins
storage: /verdaccio/storage/data
uplinks:
  npmjs:
    url: https://registry.npmjs.org/
packages:
  "@*/*":
    access: $authenticated
    publish: $authenticated
    proxy: npmjs
  "**":
    access: $all
    publish: $authenticated
    proxy: npmjs
web:
  title: NPM Registry
  showInfo: false	
logs:
  - { type: stdout, format: pretty, level: debug }

Contribute to Verdaccio

  • I'm willing to fix this bug 🥇

Should I just fix defaultUserState in store value, depending on isTokenExpire? Maybe I missed something about JWTVerifyOptions.ignoreExpiration?

const defaultUserState: LoginBody = isTokenExpire(token)
  ? { token: null, username: null }
  : { token, username };
@juanpicado
Copy link
Member

small question, What's the context of isTokenExpire ? where it comes from?

@Ku3mi41
Copy link
Contributor Author

Ku3mi41 commented Aug 20, 2023

import { isTokenExpire } from 'verdaccio-ui/utils/login';

Simple token expiration and format checking function.

@mrcego
Copy link

mrcego commented Aug 22, 2023

Related to: #3163

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

No branches or pull requests

3 participants