Skip to content

Commit 67529c5

Browse files
committed
Pass state param to github callback
1 parent 376be2a commit 67529c5

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

frontend/src/App/Login/LoginByGithubCallback/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ export const LoginByGithubCallback: React.FC = () => {
1919
const [searchParams] = useSearchParams();
2020
const navigate = useNavigate();
2121
const code = searchParams.get('code');
22+
const state = searchParams.get('state');
2223
const [isInvalidCode, setIsInvalidCode] = useState(false);
2324
const dispatch = useAppDispatch();
2425

2526
const [githubCallback] = useGithubCallbackMutation();
2627
const [getProjects] = useLazyGetProjectsQuery();
2728

2829
const checkCode = () => {
29-
if (code) {
30-
githubCallback({ code })
30+
if (code && state) {
31+
githubCallback({ code, state })
3132
.unwrap()
3233
.then(async ({ creds: { token } }) => {
3334
dispatch(setAuthData({ token }));

frontend/src/services/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const authApi = createApi({
1919
}),
2020
}),
2121

22-
githubCallback: builder.mutation<IUserWithCreds, { code: string }>({
22+
githubCallback: builder.mutation<IUserWithCreds, { code: string; state: string }>({
2323
query: (body) => ({
2424
url: API.AUTH.GITHUB.CALLBACK(),
2525
method: 'POST',

0 commit comments

Comments
 (0)