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

Laravel Passport not being auto redirected to homepage #1295

Closed
stephenjason89 opened this issue Sep 13, 2021 · 1 comment
Closed

Laravel Passport not being auto redirected to homepage #1295

stephenjason89 opened this issue Sep 13, 2021 · 1 comment
Labels

Comments

@stephenjason89
Copy link

stephenjason89 commented Sep 13, 2021

Does anyone encounter that everytime the browser is closed. if the user opens the browser and navigates to your site, even if they have a valid token, they will be redirected to the login page and won't be redirected to the homepage.

I can clearly see an xhr call to my user endpoint which returns an authenticated user.

However, if you don't close the browser and just open a new tab, the user is directly redirected to homepage or any url that he is visiting. This is the correct behavior. It should be the same even if it is a newly opened browser.

    "@nuxtjs/auth-next": "^5.0.0-1621716493.b9b36c6",
    nuxt - universal

Nuxt configuration

 auth: {
        plugins: [{ src: '~/plugins/axios', ssr: true }, '~/plugins/auth'],
        redirect: {
            login: '/login',
            logout: '/login',
            callback: '/callback',
            home: '/',
        },
        cookie: {
            secure: process.env.WS_HOSTNAME === 'foodat.ph',
        },
        localStorage: {
            prefix: 'auth.',
        },
        strategies: {
            laravelPassportPasswordGrant: {
                provider: 'laravel/passport',
                url: '/central',
                endpoints: {
                    user: {
                        url: '/api/user',
                    },
                },
                token: {
                    maxAge: 60 * 60 * 2,
                },
                refreshToken: {
                    maxAge: 60 * 60 * 24 * 30,
                },
                clientId: process.env.PASSPORT_CLIENT_ID,
                clientSecret: process.env.PASSPORT_CLIENT_SECRET,
                grantType: 'password',
            },
      },
  }
@stephenjason89 stephenjason89 changed the title Laravel Passport Laravel Passport not being auto redirected to homepage Sep 13, 2021
@bmulholland
Copy link
Contributor

You didn't use the bug template so I don't have all the info I need. If you're using SSR, see #1197

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

No branches or pull requests

2 participants