0

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

auth: {
  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.

kissu
  • 40,416
  • 14
  • 65
  • 133
RmR
  • 1,917
  • 1
  • 22
  • 35
  • You could always have a `serverMiddleware` endpoint on the given localhost. What is the end goal here? – kissu Aug 29 '22 at 14:06
  • Thanks @kissu. However, I am running this on a pure browser client. The java script login function that I am referring to is a java script library that internally "talks" to the back end and does not expose an API that can be invoked via fetch – RmR Aug 30 '22 at 02:40

0 Answers0