fix: auth callback

This commit is contained in:
Steven 2024-08-13 08:58:53 +08:00
parent db09ac2c5c
commit d4e575774c
2 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,3 @@
import { last } from "lodash-es";
import { ClientError } from "nice-grpc-web"; import { ClientError } from "nice-grpc-web";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useSearchParams } from "react-router-dom"; import { useSearchParams } from "react-router-dom";
@ -34,7 +33,7 @@ const AuthCallback = () => {
return; return;
} }
const idpId = last(state.split("-")); const idpId = state;
if (!idpId) { if (!idpId) {
setState({ setState({
loading: false, loading: false,

View File

@ -62,7 +62,7 @@ const SignIn: React.FC = () => {
}; };
const handleSignInWithIdentityProvider = async (identityProvider: IdentityProvider) => { const handleSignInWithIdentityProvider = async (identityProvider: IdentityProvider) => {
const stateQueryParameter = `auth.signin.${identityProvider.title}-${identityProvider.id}`; const stateQueryParameter = identityProvider.id;
if (identityProvider.type === IdentityProvider_Type.OAUTH2) { if (identityProvider.type === IdentityProvider_Type.OAUTH2) {
const redirectUri = absolutifyLink("/auth/callback"); const redirectUri = absolutifyLink("/auth/callback");
const oauth2Config = identityProvider.config?.oauth2; const oauth2Config = identityProvider.config?.oauth2;