DEV Community

Discussion on: PKCE authenticaton for Nuxt SPA with Laravel as backend

 
stefant123 profile image
StefanT123

See if the post request has been enabled for CORS

Thread Thread
 
thorbn profile image
Thor

how can I see that? i'm new to cors, its hard to debug when it works local but not on the server

Thread Thread
 
stefant123 profile image
StefanT123

Read the documentation for fruitcake/laravel-cors

Thread Thread
 
thorbn profile image
Thor

When I read the docs I can't find info on what to change to get post to work . Do you know where to se an example on a Update with "post" have been used, with Nuxt/Passport? almost all examples are just GET

Thread Thread
 
thorbn profile image
Thor • Edited

Now it works. :)

My post looks like:

    const access_token = cookies.get('x-access-token');
    this.$axios.setToken(access_token, 'Bearer')

    this.$axios.setHeader('Content-Type', 'application/json', [
      'post'
    ])

    this.$axios
      .$post(process.env.LARAVEL_ENDPOINT + "/api/trials", {

        grant_type: 'authorization_code',
        client_id: 1,
        ..................

I also removed a / from /api/trials (is was /api/trials/)

I will try later to remove some of the code to see if it all have to be there.