mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
c5b1fed805
* feat(ui): add social sign-in binding page add social sing-in binding page * feat(ui): temp redirect to the username sign-in page temp redirect to the username sign-in page * fix(ui): fix style missing bug fix style missing bug
80 lines
1.4 KiB
TypeScript
80 lines
1.4 KiB
TypeScript
import ky from 'ky';
|
|
|
|
export const invokeSocialSignIn = async (
|
|
connectorId: string,
|
|
state: string,
|
|
redirectUri: string
|
|
) => {
|
|
type Response = {
|
|
redirectTo: string;
|
|
};
|
|
|
|
return ky
|
|
.post('/api/session/sign-in/social', {
|
|
json: {
|
|
connectorId,
|
|
state,
|
|
redirectUri,
|
|
},
|
|
})
|
|
.json<Response>();
|
|
};
|
|
|
|
export const signInWithSocial = async (parameters: {
|
|
connectorId: string;
|
|
state: string;
|
|
redirectUri: string;
|
|
code: string;
|
|
}) => {
|
|
type Response = {
|
|
redirectTo: string;
|
|
};
|
|
|
|
return ky
|
|
.post('/api/session/sign-in/social', {
|
|
json: parameters,
|
|
})
|
|
.json<Response>();
|
|
};
|
|
|
|
export const bindSocialAccount = async (connectorId: string) => {
|
|
type Response = {
|
|
redirectTo: string;
|
|
};
|
|
|
|
return ky
|
|
.post('/api/session/sign-in/bind-social', {
|
|
json: {
|
|
connectorId,
|
|
},
|
|
})
|
|
.json<Response>();
|
|
};
|
|
|
|
export const bindSocialRelatedUser = async (connectorId: string) => {
|
|
type Response = {
|
|
redirectTo: string;
|
|
};
|
|
|
|
return ky
|
|
.post('/api/session/sign-in/bind-social-related-user', {
|
|
json: {
|
|
connectorId,
|
|
},
|
|
})
|
|
.json<Response>();
|
|
};
|
|
|
|
export const registerWithSocial = async (connectorId: string) => {
|
|
type Response = {
|
|
redirectTo: string;
|
|
};
|
|
|
|
return ky
|
|
.post('/api/session/register/social', {
|
|
json: {
|
|
connectorId,
|
|
},
|
|
})
|
|
.json<Response>();
|
|
};
|