auth-module icon indicating copy to clipboard operation
auth-module copied to clipboard

"TypeError: _schemes_index_js__WEBPACK_IMPORTED_MODULE_7___default.a is not a constructor" when setting "cookie" auth strategy

Open franck-grenier opened this issue 2 years ago • 5 comments

Hello, I'm trying to change the auth strategy of my Nuxt (2.14.11) app from local to cookie and I'm getting this error :

TypeError: _schemes_index_js__WEBPACK_IMPORTED_MODULE_7___default.a is not a constructor

(I'm using @nuxtjs/auth 4.9.1.)

I guess my TS compilation is faulty here but I can't understand why with cookie and why not with local.

Thanks for your help !

franck-grenier avatar Mar 09 '22 17:03 franck-grenier

I'm facing the same issue.

ebi-yade avatar Apr 18 '22 04:04 ebi-yade

I'm also seeing this issue.

justindasilva avatar May 20 '22 15:05 justindasilva

Hello, I fixed this problem with the below configuration :

{
    auth: {
        cookie: {
            options: {
                expires: 365,
                secure: process.env.APP_ENV !== 'local',
            },
        },
        strategies: {
            local: {
                endpoints: {
                    login: {
                        url: 'auth/login',
                        method: 'post',
                        propertyName: 'token',
                    },
                    user: {
                        url: 'users/me',
                        method: 'get',
                        propertyName: null,
                    },
                    logout: false,
                },
            },
        },
        plugins: [
            '~/plugins/updateLoggedInUser.js',
        ],
    },
}

My goal was to change the parameters of the local strategy cookie.

Hope it will help

franck-grenier avatar May 23 '22 09:05 franck-grenier

Hello, I fixed this problem with the below configuration :

{
    auth: {
        cookie: {
            options: {
                expires: 365,
                secure: process.env.APP_ENV !== 'local',
            },
        },
        strategies: {
            local: {
                endpoints: {
                    login: {
                        url: 'auth/login',
                        method: 'post',
                        propertyName: 'token',
                    },
                    user: {
                        url: 'users/me',
                        method: 'get',
                        propertyName: null,
                    },
                    logout: false,
                },
            },
        },
        plugins: [
            '~/plugins/updateLoggedInUser.js',
        ],
    },
}

My goal was to change the local strategy cookie params.

Hope it will help

Also faced with the same issue. Configuration above solved my problem. Thanks!

kostandy avatar Jun 08 '22 12:06 kostandy

We have the same issue on Nuxt2 with vue 2.7 !

MatthD avatar Jul 05 '22 16:07 MatthD