nuxt-community / auth-module

Zero-boilerplate authentication support for Nuxt 2
https://auth.nuxtjs.org
MIT License
1.93k stars 924 forks source link

Can a local scheme have an endpoint which is a javascript custom function and not a axios api call #1777

Open rmr-code opened 2 years ago

rmr-code commented 2 years ago

Hello:

I have a need where after getting the username and password of a user, I wish to call a javascript function (which does whatever) to confirm successful login. Would something like this be possible using the auth-module

  strategies: {
    local: {
      token: {
        property: 'token',
        global: true,
        // required: true,
        // type: 'Bearer'
      },
      user: {
        property: 'user',
        // autoFetch: true
      },
      endpoints: {
        login: { url: '/api/auth/login', method: 'post' }, // is there a way to call a javascript function HERE
        logout: { url: '/api/auth/logout', method: 'post' },
        user: { url: '/api/auth/user', method: 'get' }
      }
    }
  }
}

I looked at the documentation of the customscheme (https://auth.nuxtjs.org/guide/scheme#creating-your-own-scheme) but could not determine where to place the custom js function.

Thanks

Thanks