mirror of
https://github.com/logto-io/logto.git
synced 2025-02-03 21:48:55 -05:00
63 lines
1.1 KiB
TypeScript
63 lines
1.1 KiB
TypeScript
|
import ky from 'ky';
|
||
|
|
||
|
export const signInWithSocial = 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 signInToSoical = 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-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>();
|
||
|
};
|