I'm using NUXT.js, ans the nuxt/auth module.
I can call my API, but i can't get the data:
My nuxt method:
try {
let response = await this.$auth.loginWith('local', { data: this.login })
console.log(response)
} catch (err) {
console.log(err)
}
In the login data, i have password and email.
My nuxt.config.js :
auth: {
strategies: {
local: {
endpoints: {
login: {
url: API_URL_LOGIN,
method: 'post'
},
logout: {
url: API_URL_LOGOUT,
method: 'post'
},
user: {
url: API_URL_USER,
method: 'post'
}
}
}
},
},
In my PHP API, I'm trying to collect Email and Password data, but... I have NOTHING in $_POST (or $_GET)
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type, X-Requested-With, Authorization');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUT');
header('Content-Type: application/json;charset=utf-8');
$return['post'] = $_POST;
$return['get'] = $_GET;
echo json_encode($return);
?>
And so, with my console.log(response), i have :
Config:
baseURL: "http://localhost:3000/"
data: "{"username":"vincent.blondaux@gmail.com","password":"admin"}"
headers: {Accept: "application/json, text/plain, */*", Content-Type: "application/json;charset=utf-8"}
method: "post"
url: "...url.../login.php"
...
data:
get: []
post: []
Any ideas? Thanks a lot! Vincent