I'm getting 401 "Error: Request failed with status code 401", when i hit this api for creating user.
complete
s
shubham
const apiEndpoint =
https://api.adapty.io/api/v1/sdk/profiles/
;const apiKey = 'secret_live_BEHrYLTr.***********
\
\\
************';const headers = {
Authorization:
Api-Key ${apiKey}
,'Content-Type': 'application/json',
};
let data = {
customer_user_id: "45456456465",
};
axios
.post(apiEndpoint, data, { headers })
.then((response) => {
console.log("Response:", response.data);
})
.catch((error) => {
console.log("error", error);
console.error("Error:", error.message);
});
Adapty Support
complete
a
adapty access
Hi there! Thank you for contacting us.
Could you please provide me with your app name? I will try to reproduce the issue.
Also, while creating a user, please follow the instructions via link: https://docs.adapty.io/docs/server-side-api-specs#create-a-user
Note that it must be a POST request and you must set Authorization header with value "Api-Key {secret_token}" (without quotes) to each request, for example "Api-Key secret_live_BEHrYLTr.ce5zuDEWz06lFRNiaJC8mrLtL8fUwswD".
Hope that helps!