mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 02:02:23 +00:00
fix: json response from proto message
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { startIdentityProviderFlow } from "@/lib/zitadel";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { toJson } from "@zitadel/client";
|
||||
import { StartIdentityProviderIntentResponseSchema } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
@@ -14,7 +16,9 @@ export async function POST(request: NextRequest) {
|
||||
},
|
||||
})
|
||||
.then((resp) => {
|
||||
return NextResponse.json(resp);
|
||||
return NextResponse.json(
|
||||
toJson(StartIdentityProviderIntentResponseSchema, resp),
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
return NextResponse.json(error, { status: 500 });
|
||||
|
||||
@@ -15,7 +15,9 @@ import {
|
||||
createSessionForIdpAndUpdateCookie,
|
||||
setSessionAndUpdateCookie,
|
||||
} from "@/utils/session";
|
||||
import { toJson } from "@zitadel/client";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { SessionSchema } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const body = await request.json();
|
||||
@@ -36,7 +38,7 @@ export async function POST(request: NextRequest) {
|
||||
organization,
|
||||
authRequestId,
|
||||
).then((session) => {
|
||||
return NextResponse.json(session);
|
||||
return NextResponse.json(toJson(SessionSchema, session));
|
||||
});
|
||||
} else {
|
||||
return createSessionAndUpdateCookie(
|
||||
@@ -46,7 +48,7 @@ export async function POST(request: NextRequest) {
|
||||
organization,
|
||||
authRequestId,
|
||||
).then((session) => {
|
||||
return NextResponse.json(session);
|
||||
return NextResponse.json(toJson(SessionSchema, session));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user