Skip to content

Commit

Permalink
Merge pull request #274 from near/fix-social-login
Browse files Browse the repository at this point in the history
Social login url fix by including basepath
  • Loading branch information
hcho112 authored Aug 6, 2024
2 parents a3b29f6 + a1c8f15 commit 3dfe448
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useSearchParams } from 'react-router-dom';
import styled from 'styled-components';

import { extractQueryParams } from '../../utils';
import { basePath } from '../../utils/config';

const Button = styled.button`
font-size: 14px;
Expand Down Expand Up @@ -49,7 +50,7 @@ const SocialButton: React.FC<SocialButtonProps> = ({
const onClick = async () => {
const paramNames = ['success_url', 'failure_url', 'public_key', 'methodNames', 'contract_id'];
const params = extractQueryParams(searchParams, paramNames);
const parsedUrl = new URL(`${window.location.origin}/auth-callback${Object.keys(params).length > 0 ? `?${searchParams.toString()}` : ''}`);
const parsedUrl = new URL(`${window.location.origin}${basePath ? `/${basePath}` : ''}/auth-callback${Object.keys(params).length > 0 ? `?${searchParams.toString()}` : ''}`);
parsedUrl.searchParams.set('socialLoginName', label.toLocaleLowerCase());
if (params.public_key) {
parsedUrl.searchParams.set('public_key_lak', params.public_key);
Expand Down

0 comments on commit 3dfe448

Please sign in to comment.