Pular para o conteúdo principal
export const getToken = () => {
const url = "https://maestro.dadosfera.ai/auth/sign-in";
const data = {
username: process.env.EMAIL,
password: process.env.PASSWORD,
totp: process.env.TOTP_CODE,
};

return fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})
.then((response) => {
if (response.ok) return response.json();
else throw response.statusText;
})
.then((data) => data.tokens.accessToken);
};
{"success":true}

Configure request options

In this step, it is necessary to configure some request parameters in the options object. In the data object, it is necessary to pass the credentials to get the token.

Build the request

Using the settings build the request.