fix: add /auth/callback redirect for Casdoor OIDC flow
This commit is contained in:
@@ -19,6 +19,10 @@ export async function GET(req: NextRequest) {
|
||||
}
|
||||
|
||||
// Exchange authorization code for tokens
|
||||
const REDIRECT_URI =
|
||||
process.env.NEXT_PUBLIC_CASDOOR_REDIRECT_URI ||
|
||||
"https://mobile2.falahos.my/mobile/auth/callback";
|
||||
|
||||
const tokenRes = await fetch(CASDOOR_TOKEN_URL, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
||||
@@ -28,7 +32,7 @@ export async function GET(req: NextRequest) {
|
||||
client_secret: CLIENT_SECRET,
|
||||
code,
|
||||
// redirect_uri must match exactly what was used in authorize request
|
||||
redirect_uri: "https://mobile2.falah-os.com/auth/callback",
|
||||
redirect_uri: REDIRECT_URI,
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ const getCasdoorUrl = () => {
|
||||
const base = process.env.NEXT_PUBLIC_CASDOOR_SERVER_URL || "https://auth.falahos.my";
|
||||
const clientId = process.env.NEXT_PUBLIC_CASDOOR_CLIENT_ID || "272f91105da5cf984773";
|
||||
const redirect = process.env.NEXT_PUBLIC_CASDOOR_REDIRECT_URI ||
|
||||
"https://mobile2.falah-os.com/auth/callback";
|
||||
"https://mobile2.falahos.my/mobile/auth/callback";
|
||||
return `${base}/login/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirect)}&response_type=code&scope=openid+profile+email&state=${state}`;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user