Hello I'm trying to connect to VRM portal via axios / nodejs / vuejs
but I'cant find exemple of code.
I get the token & userId but after the token no longuer seem valid for other end points ?
when I use token in header with header :
var headers = 'Authorization': 'Bearer ' + token };
https://vrmapi.victronenergy.com/v2/users/***myUserId****/installations
Apti return 401.
Some ideas/exemples please ? thanks by advance
Yann
my code (login)
const params = {
'username': '******@gmail.com',
'password': '******',
}
const header = {
'Content-Type': 'application/x-www-form-urlencoded'
}
/**
* call via axios
*/
await Axios.post('https://vrmapi.victronenergy.com/v2/auth/login/', params , header).then ((resp)=>{
return resp
/** return
*
*response": {
"Token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjdkZTcw******************"
"idUser": *****, // ok
"verification_mode": "password",
"verification_sent": false
}
*
*
*/
}).catch((err) => console.log(err.message));