I want to connect to ovh cloud with axios.
const username = 'user-123456';
const accessKey = '1242121414421';
const secretKey = '2414124141';
const containerName = 'storage';
const endpoint = 'https://s3.de.io.cloud.ovh.net/v1/AUTH_' + accessKey + '/' + containerName;
await axios
.post('https://auth.cloud.ovh.net/v3/auth/tokens', {
auth: {
identity: {
methods: ['password'],
password: {
user: {
name: username,
domain: { id: 'default' },
password: secretKey,
},
},
},
scope: {
project: { id: containerName },
domain: { id: 'default' },
},
},
})
.then((response) => {
const token = response.data.token.id;
// List containers
axios
.get(`https://${containerName}.s3.de.io.cloud.ovh.net/v1/AUTH_${accessKey}`, {
headers: {
'X-Auth-Token': token,
},
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error('Error listing containers:', error.message);
});
})
.catch((error) => {
console.error('Error authenticating:', error);
console.log('Error details:', error.response.data);
});
I am getting error like this: Error details: Expecting to find system, project, domain, OS-TRUST:trust or unscoped in scope. The server could not comply with the request since it is either malformed or otherwise incorrect. The client is assumed to be in error.
I can't figured out what's wrong