mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
refactor(core): fix passwordless flow ITs
This commit is contained in:
parent
fdc835a938
commit
365e381344
1 changed files with 72 additions and 36 deletions
|
@ -51,112 +51,148 @@ export const consent = async (interactionCookie: string) =>
|
|||
.json<RedirectResponse>();
|
||||
|
||||
export const sendRegisterUserWithEmailPasscode = (email: string, interactionCookie: string) =>
|
||||
api.post('session/register/passwordless/email/send-passcode', {
|
||||
api.post('session/passwordless/email/send', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
flow: 'register',
|
||||
},
|
||||
});
|
||||
|
||||
export const verifyRegisterUserWithEmailPasscode = (
|
||||
export const verifyRegisterUserWithEmailPasscode = async (
|
||||
email: string,
|
||||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api
|
||||
.post('session/register/passwordless/email/verify-passcode', {
|
||||
) => {
|
||||
await api.post('session/passwordless/email/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
flow: 'register',
|
||||
},
|
||||
});
|
||||
|
||||
return api
|
||||
.post('session/register/passwordless/email', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
};
|
||||
|
||||
export const sendSignInUserWithEmailPasscode = (email: string, interactionCookie: string) =>
|
||||
api.post('session/sign-in/passwordless/email/send-passcode', {
|
||||
api.post('session/passwordless/email/send', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
flow: 'sign-in',
|
||||
},
|
||||
});
|
||||
|
||||
export const verifySignInUserWithEmailPasscode = (
|
||||
export const verifySignInUserWithEmailPasscode = async (
|
||||
email: string,
|
||||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api
|
||||
.post('session/sign-in/passwordless/email/verify-passcode', {
|
||||
) => {
|
||||
await api.post('session/passwordless/email/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
flow: 'sign-in',
|
||||
},
|
||||
});
|
||||
|
||||
return api
|
||||
.post('session/sign-in/passwordless/email', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
email,
|
||||
code,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
};
|
||||
|
||||
export const sendRegisterUserWithSmsPasscode = (phone: string, interactionCookie: string) =>
|
||||
api.post('session/register/passwordless/sms/send-passcode', {
|
||||
api.post('session/passwordless/sms/send', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
flow: 'register',
|
||||
},
|
||||
});
|
||||
|
||||
export const verifyRegisterUserWithSmsPasscode = (
|
||||
export const verifyRegisterUserWithSmsPasscode = async (
|
||||
phone: string,
|
||||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api
|
||||
.post('session/register/passwordless/sms/verify-passcode', {
|
||||
) => {
|
||||
await api.post('session/passwordless/sms/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
flow: 'register',
|
||||
},
|
||||
});
|
||||
|
||||
return api
|
||||
.post('session/register/passwordless/sms', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
};
|
||||
|
||||
export const sendSignInUserWithSmsPasscode = (phone: string, interactionCookie: string) =>
|
||||
api.post('session/sign-in/passwordless/sms/send-passcode', {
|
||||
api.post('session/passwordless/sms/send', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
flow: 'sign-in',
|
||||
},
|
||||
});
|
||||
|
||||
export const verifySignInUserWithSmsPasscode = (
|
||||
export const verifySignInUserWithSmsPasscode = async (
|
||||
phone: string,
|
||||
code: string,
|
||||
interactionCookie: string
|
||||
) =>
|
||||
api
|
||||
.post('session/sign-in/passwordless/sms/verify-passcode', {
|
||||
) => {
|
||||
await api.post('session/passwordless/sms/verify', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
flow: 'sign-in',
|
||||
},
|
||||
});
|
||||
|
||||
return api
|
||||
.post('session/sign-in/passwordless/sms', {
|
||||
headers: {
|
||||
cookie: interactionCookie,
|
||||
},
|
||||
json: {
|
||||
phone,
|
||||
code,
|
||||
},
|
||||
})
|
||||
.json<RedirectResponse>();
|
||||
};
|
||||
|
||||
export const signInWithSocial = (
|
||||
payload: {
|
||||
|
|
Loading…
Reference in a new issue