mirror of
https://github.com/logto-io/logto.git
synced 2025-03-10 22:22:45 -05:00
fix(console): profile social linking in cloud env should use correct URL without double slashes (#3300)
This commit is contained in:
parent
5cfbe87a04
commit
11471c4308
1 changed files with 6 additions and 3 deletions
|
@ -49,8 +49,9 @@ const LinkAccountSection = ({ user, onUpdate }: Props) => {
|
||||||
|
|
||||||
const getSocialAuthorizationUri = useCallback(
|
const getSocialAuthorizationUri = useCallback(
|
||||||
async (connectorId: string) => {
|
async (connectorId: string) => {
|
||||||
|
const adminTenantEndpointUrl = new URL(adminTenantEndpoint);
|
||||||
const state = buildIdGenerator(8)();
|
const state = buildIdGenerator(8)();
|
||||||
const redirectUri = `${adminTenantEndpoint}/callback/${connectorId}`;
|
const redirectUri = new URL(`/callback/${connectorId}`, adminTenantEndpointUrl).toString();
|
||||||
const { redirectTo } = await api
|
const { redirectTo } = await api
|
||||||
.post('me/social/authorization-uri', { json: { connectorId, state, redirectUri } })
|
.post('me/social/authorization-uri', { json: { connectorId, state, redirectUri } })
|
||||||
.json<{ redirectTo: string }>();
|
.json<{ redirectTo: string }>();
|
||||||
|
@ -67,6 +68,8 @@ const LinkAccountSection = ({ user, onUpdate }: Props) => {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const adminTenantEndpointUrl = new URL(adminTenantEndpoint);
|
||||||
|
|
||||||
return connectors.map(({ id, name, logo, logoDark, target }) => {
|
return connectors.map(({ id, name, logo, logoDark, target }) => {
|
||||||
const logoSrc = theme === AppearanceMode.DarkMode && logoDark ? logoDark : logo;
|
const logoSrc = theme === AppearanceMode.DarkMode && logoDark ? logoDark : logo;
|
||||||
const relatedUserDetails = user.identities[target]?.details;
|
const relatedUserDetails = user.identities[target]?.details;
|
||||||
|
@ -108,7 +111,7 @@ const LinkAccountSection = ({ user, onUpdate }: Props) => {
|
||||||
const authUri = await getSocialAuthorizationUri(id);
|
const authUri = await getSocialAuthorizationUri(id);
|
||||||
const callback = new URL(
|
const callback = new URL(
|
||||||
`${getBasename()}/handle-social`,
|
`${getBasename()}/handle-social`,
|
||||||
`${adminTenantEndpoint}`
|
adminTenantEndpointUrl
|
||||||
).toString();
|
).toString();
|
||||||
|
|
||||||
const queries = new URLSearchParams({
|
const queries = new URLSearchParams({
|
||||||
|
@ -118,7 +121,7 @@ const LinkAccountSection = ({ user, onUpdate }: Props) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const newWindow = popupWindow(
|
const newWindow = popupWindow(
|
||||||
`${adminTenantEndpoint}/springboard?${queries.toString()}`,
|
new URL(`/springboard?${queries.toString()}`, adminTenantEndpointUrl).toString(),
|
||||||
'Link social account with Logto',
|
'Link social account with Logto',
|
||||||
600,
|
600,
|
||||||
640
|
640
|
||||||
|
|
Loading…
Add table
Reference in a new issue