damp-fountain-38244
04/17/2024, 10:20 PMmagnificent-energy-493
damp-fountain-38244
04/18/2024, 11:07 PMconst getUserToken = async (): Promise<string> => {
const flow = await frontendAPI.createNativeLoginFlow();
const response = await fetch(flow.data.ui.action, {
method: 'POST',
body: `csrf_token=&identifier=${SAMPLE_EMAIL}&password=${SAMPLE_PASSWORD}&method=password`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
const session = await response.json();
return session?.session_token || '';
}
billowy-actor-35983
04/19/2024, 2:50 PMupdateNativeLoginFlow
method instead of using fetch?damp-fountain-38244
04/19/2024, 3:03 PMconst getUserToken = async (): Promise<string> => {
const flow = await frontendAPI.createNativeLoginFlow();
const response = await frontendAPI.updateLoginFlow({
flow: flow.data.id,
updateLoginFlowBody: {
identifier: SAMPLE_EMAIL,
password: SAMPLE_PASSWORD,
method: 'password'
}
})
const session = response.data;
return session?.session_token || '';
}