0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-10 22:22:45 -05:00

fix(console): fix the link social feature on logto cloud (#5838)

This commit is contained in:
Charles Zhao 2024-05-10 10:53:22 +08:00 committed by GitHub
parent 50f336c7d3
commit feae37b9b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,7 +34,7 @@ type Props = {
function LinkAccountSection({ user, connectors, onUpdate }: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const { navigate, getUrl } = useTenantPathname();
const { navigate } = useTenantPathname();
const theme = useTheme();
const { show: showConfirm } = useConfirmModal();
const api = useStaticApi({ prefixUrl: adminTenantEndpoint, resourceIndicator: meApi.indicator });
@ -96,7 +96,10 @@ function LinkAccountSection({ user, connectors, onUpdate }: Props) {
name: 'profile.link',
handler: async () => {
const authUri = await getSocialAuthorizationUri(id);
const callback = getUrl('handle-social').href;
// Profile page has been moved to the root path instead of being nested inside a tenant context.
// Therefore, we don't need to use `getUrl` to prepend the tenant segment in the callback URL.
// Also, link social is Cloud only, so no need to conditionally prepend the `ossConsolePath`, either.
const callback = new URL('/handle-social', window.location.href).href;
const queries = new URLSearchParams({
redirectTo: authUri,
@ -125,7 +128,6 @@ function LinkAccountSection({ user, connectors, onUpdate }: Props) {
t,
onUpdate,
getSocialAuthorizationUri,
getUrl,
]);
return (