Repository auth-module


appinteractive posted a new question

auth-module • 4 days ago

getting vuex-rest-api working with auth-module

Hey I have the following issue…

I need nuxt-auth to work with that package but at the point of creation I cant pass any axios instance, and thre is no global one. The result is that I get 401 response as I cant use the correct axios instance with the auth logic. Any idea?

in Nuxtj.s I create a store

import Vuex from 'vuex'
import userStore from './users'

const createStore = () => {
  return new Vuex.Store({
    state: {
    mutations: {
    modules: {
      users: userStore

export default createStore

users store

import Vapi from 'vuex-rest-api'

const userStore = new Vapi({
  baseURL: '/api',
  state: {
    users: [],
    groups: []
    action: 'getUsers',
    property: 'users',
    path: '/users/getUsersTableData'
    action: 'getGroups',
    property: 'groups',
    path: '/users/getGroupsTableData'

export default userStore.getStore()


tanggaowei posted a new bug report

auth-module • 4 days ago

bug TypeError: request.charCodeAt is not a function

[16:56:06] TypeError: request.charCodeAt is not a function
at Function.Module.resolveLookupPaths (internal/modules/cjs/loader.js:408:15) at Function.Module.resolveFilename (internal/modules/cjs/loader.js:574:20)
at Nuxt.resolveModule (F:\Javaspace\general\general-card-www\node[email protected]@nuxt-edge\dist\nuxt.js:2178:35) at Nuxt.resolveAlias (F:\Javaspace\general\general-card-www\node[email protected]@nuxt-edge\dist\nuxt.js:2193:29)
at (<anonymous>)
at Builder.watchFiles (F:\Javaspace\general\general-card-www\node[email protected]@nuxt-edge\dist\nuxt.js:3878:37) at Builder.webpackDev (F:\Javaspace\general\general-card-www\node[email protected]@nuxt-edge\dist\nuxt.js:3829:10)
at Promise (F:\Javaspace\general\general-card-www\[email protected]@nuxt-edge\dist\nuxt.js:3755:23)


jay7793 posted a new question

auth-module • 7 days ago

How to response token form server side to front-end Vue.js after logged-in

Hi, Guy

I'm using Oauth2 Facebook login by setting response_type code to the server for making authentication. I'm using Laravel Socialite with JWT-Auth to generate a token. Then the user has been authenticated the server will generate the token with response type JSON. I'm want to know how to pass the token to front-end Vue.js app.

nuxt-config.js (Auth Module)
auth: { strategies: { facebook: { client_id: process.env.FACEBOOK_CLIENT_ID, userinfo_endpoint: ',name,picture{url},email,birthday', scope: ['public_profile', 'email', 'user_birthday'], redirect_uri: `${process.env.APP_URL}/oauth/facebook/callback`, response_type: 'code' } } }

After authenticate from server

Thanks in advance for any help that you are able to provide.


nathanchase posted a new feature request

auth-module • 12 days ago

idea REQ: Helper method to provide direct access to JWT payload

What problem does this feature solve?

Instead of making a separate call to an API endpoint for user data, it would be nice to be able to simply access the username that already exists inside the encoded JWT data object.

A simple function like the following (that takes advantage of jwtDecode) would suffice:

function getPayload(token) {
    var payload = null;

    try {
      payload = token ? jwtDecode(token) : null;
    } catch (_) {}

    return payload;

This will provide the JWT's data object, like:

   username: "JohnDoe",
   scope: "user"

What does the proposed changes look like?

Offer a method to access the JWT payload directly


roosh-t3 posted a new feature request

auth-module • 13 days ago

idea Manully setting up user token setToken()

What problem does this feature solve?

When a token is added manually Axios doesn't attach the token. As for my auth flow it is required.

What does the proposed changes look like?

When setting a token manually using $auth.setToken calling this.$$axios.setHeader(this.options.tokenName, token) this would solves the manual login problem.


MathiasCiarlo posted a new question

auth-module • 22 days ago

Keycloak provider support

Hello there, and thank you for your work on this project.
I am trying to authenticate against Keycloak, and have until now been using the closed branch

If I have understood things correctly, the PR was declined because the module is going to be refactored so that providers(like keycloak) are not part of the module, but instead imported as their own modules.

I have two questions:
1: What's the current status of the refactoring, and Keycloak? What do you recommend me doing going forwards?

2: @robsontenorio 's branch had some issues where the user was not logged in after redirect, but the cookies was set, so a refresh would log in the user. Also, logout did not work at all, do you(@robsontenorio) have any any tips or ideas about this? :)

Hope you can help, I really appreciate your work!


schjetne posted a new question

auth-module • 22 days ago

Resource Owner Password Grant functionality?

Hi! I’m working on a trusted app and I’d like to implement in-app authentication using Oauth2’s Resource Owner Password Grant, but I cannot for the life of me figure out how to with the Nuxtjs Auth module.

Is it even possible? And if so, can someone point me in the right direction? The docs aren’t very helpful.

Thank you!


Tarik02 posted a new question

auth-module • a month ago

Custom backend API authentication

I have a backend server (in Symfony) which also has oauth server. I can login with curl:

$ curl -X POST -d "client_id=...&client_secret=...&grant_type=password&username=...&password=..."

Then I just need to add access_token from the response to every API call.

How can I use that login with auth-module?


mwargan posted a new question

auth-module • a month ago

Using laravel.passport on static PWA

I'm hosting my Nuxt PWA app on S3, but can't log in with laravel.passport because once I receive the code the module attempts to POST to _auth/oauth/laravel.passport/authorize, but S3 can't support POST requests and there is no directory like _auth in the dist after running nuxt build. How can I use laravel.passport on a client-side PWA hosted on S3?


mwargan posted a new question

auth-module • a month ago

Deleting client_secret in custom scheme

I see that the laravel.passport provider calls addAuthorize which in turn deletes the client_secret, so its not visible in the dist code. How can I delete the client_secret when using a custom scheme?


mwargan posted a new question

auth-module • a month ago

How to maintain user state after refresh on static site?

I'm able to log in without a problem using a custom strategy, but upon refresh I'm logged out again. This happens only on the live/dist version of the pwa after running npm run generate. Looking at the storage, it seems that the cookies are still set upon refresh but overwritten after the app loads.

When running in Dev, upon refresh the user is still logged in, as expected.

How do I keep the user logged in after refresh?

My source code


sobolevn posted a new feature request

auth-module • a month ago

idea Support `onError` hook during the `init` phase

What problem does this feature solve?

Currently the suggested way to bind your own error hooks is by defining a custom plugin:

// plugins/auth.js
export default function({ $auth }) {
  $auth.onError((error, name, endpoint) => {
    console.error(name, error)

And then extending the auth config like so:

  modules: {
  auth: {
     plugins: [ '~/plugins/auth.js' ]

But, the problem is that when some error happens during $auth.init().
In this case _errorListeners is not yet populated, so there's no way to intercept this error.

In my case this is token expiration error from one of the oauth providers.

How about providing any mechanism to handle errors during init()?


fernandocoronatomf posted a new question

auth-module • a month ago

Redirect depending on the strategy + other strategy questions


We're using the auth module and we have been very satisfied so far… The issue now is that I have 2 different strategies and each one has it's own admin area, with different layouts and etc.

Is there any way to redirect to login/logout/redirect-page depending on the strategy?

Also, when logged in with one strategy @ /admin-1 (for example) and accessing /admin-2 (for example) allows me to see the content of the protected area even though I logged in with a different strategy.

Any thoughts about it?


iamsayantan posted a new bug report

auth-module • a month ago

bug Script hangs inside then block of loginWith().



Reproduction link

Steps to reproduce

Hi, in our registration process I am logging the user after successful registration. And then navigation should go to the second step of registration. This is the code sample:

                  await this.$api.Auth.register(this.registration);

                  this.$auth.loginWith('local', {
                        data: {
                            password: this.registration.password

                        headers: {
                            version: '0.0.1',
                            build: '0.1',
                            'client-type': 'WEB'
                        .then(async () => {
                            console.log('Inside login then block');
                            await this.$api.Auth.updateDevice(this.$store.state.device_details);

But after successful login something freezes the window. I can not even close the tab. Rest of the system works fine. But that particular tab is frozen. I can not figure out what is causing this issue. Is this something with my code or some internals of auth module that I am missing out?

What is expected ?

Flow should continue

What is actually happening?

screen frezzes.


ngodink posted a new question

auth-module • a month ago

Integration with subdomain and single sign-on system

hello, i have 3 subdomain with nuxt.js (1 nuxt SPA mode for 3 module apps - auth, admin, member) and 1 subdomain as api with lumen (laravel-microframework).. -> as single sign-on gateway (redirect to {member/admin} if logged in / guest) -> as admin page (redirect to if not logged in) -> as member page (redirect to if not logged in) -> as a backend (PHP v7.0 using lumen - laravel microframework - without session)

i have a 2 question:

  1. what should i do to integrate this with @nuxtjs/auth-module?
  2. how to upload into shared hosting?

rahul9874563210 posted a new question

auth-module • 2 months ago

can't set custom function for user

Sorry if it is irrelevant .
I checked on docs there is no info about calling custom function for login and user setting . As you can check into nuxt.config.js file

strategies: {
      local: {
        endpoints: {
          login: {url: '/WsUsers/login', method: 'post', propertyName: '', tokenName: 'authorization' },
          logout: false,
          user: {url: '/Workshops', method: 'get', propertyName: 'data'},
        tokenRequired: true,
        tokenType: ''

here i want to call custom function which gets detail form server which i want an set it into auth.
Kinldy help.


paulmeller posted a new question

auth-module • 2 months ago

How do I get id_token for Auth0 provider?

Firstly, great job on the module and with the framework. Is it possible to return and store id_token from Auth0 as part of the integration? I need this to access and API endpoint from my app.


dasisyouyu posted a new question

auth-module • 2 months ago

I want to set user information login with.



"token": "uniq token",
"username": "name",
"email": "email"



strategies: {
local: {
  endpoints: {
          login: { url: 'approval/auth', method: 'post'},
          logout: false,
          user: false,


await this.$auth.loginWith('local', { data: this.form })
      .then(response => {

i Viewed.


limpehsh posted a new question

auth-module • 2 months ago

Implementing Demo example with create-nuxt-app and Express as server-side framework with local scheme

Wondering if anyone managed to successfully implement auth-module in create-nuxt-app and having Express as the server-side framework. Stuck at implementing the local scheme since you have Express in server/server.js and if you implement the code in middleware/auth.js, you'll get:

WARNING  Compiled with 1 warnings
warning  in ./node_modules/express/lib/view.js

81:13-25 Critical dependency: the request of a dependency is an expression

agcty posted a new bug report

auth-module • 2 months ago

bug Wrong loggedIn state when user option set in auth: { }



Reproduction link

Steps to reproduce

When i have a config like this:

auth: {
    strategies: {
      local: {
        endpoints: {
          login: {
            url: "/auth/token.json",
            method: "post",
            propertyName: "token"
          user: {
             url: "/auth/users/d2498e54-7bbe-11e8-be0f-c471feb11e42.json",
             propertyName: "user"
        tokenType: "Token"

    resetOnError: true,

    redirect: {
      home: "/haus",
      logout: "/login"

    localStorage: false

The loggedIn state in the store is always false, no matter what (even though I get back a valid token). However, when I set user to false, the loggedIn state is always true until i call logout(). The funny thing is that after i call logout() and then refresh the page, the loggedIn state is set to true again, without a valid token being stored in the cookie or localStorage (it's just set to false)

What is expected ?

It shouldn't matter if user is set or unset and after calling logout the loggedIn state should be set to false even when refreshing the page.

What is actually happening?

Depending on if user option is set or unset, the loggedIn state behaves differently. If user is set, the loggedIn state is always false. If it's not set it's always true and after calling logout, the loggedIn state is correctly set to false, but after a page refresh it's back to true again.

Additional comments?

I have middleware: ["auth”] turned on globally