0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-20 21:32:31 -05:00

refactor(ui): social sign-in api update (#763)

social sign-in api update
This commit is contained in:
simeng-li 2022-05-09 15:17:42 +08:00 committed by GitHub
parent d78c115db1
commit da3de542d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -193,12 +193,11 @@ describe('api', () => {
it('signInWithSocial', async () => {
const parameters = {
connectorId: 'connectorId',
state: 'state',
redirectUri: 'redirectUri',
code: 'code',
};
await signInWithSocial(parameters);
expect(ky.post).toBeCalledWith('/api/session/sign-in/social', {
expect(ky.post).toBeCalledWith('/api/session/sign-in/social/auth', {
json: parameters,
});
});

View file

@ -22,7 +22,6 @@ export const invokeSocialSignIn = async (
export const signInWithSocial = async (parameters: {
connectorId: string;
state: string;
redirectUri: string;
code: string;
}) => {
@ -31,7 +30,7 @@ export const signInWithSocial = async (parameters: {
};
return api
.post('/api/session/sign-in/social', {
.post('/api/session/sign-in/social/auth', {
json: parameters,
})
.json<Response>();

View file

@ -132,7 +132,11 @@ const useSocial = (options?: Options) => {
return;
}
void asyncSignInWithSocial({ connectorId, state, code, redirectUri: '' });
void asyncSignInWithSocial({
connectorId,
code,
redirectUri: `${origin}/callback/${connectorId}`,
});
},
[asyncSignInWithSocial, setToast, t]
);