20 lines
517 B
TypeScript
20 lines
517 B
TypeScript
import { NextResponse } from "next/server";
|
|
|
|
export async function GET() {
|
|
const params = new URLSearchParams({
|
|
response_type: "code",
|
|
client_id: process.env.XERO_CLIENT_ID!,
|
|
redirect_uri: process.env.XERO_REDIRECT_URI!,
|
|
scope: [
|
|
"offline_access",
|
|
"accounting.transactions",
|
|
"accounting.contacts",
|
|
"accounting.settings",
|
|
].join(" "),
|
|
state: "xero_oauth",
|
|
});
|
|
|
|
return NextResponse.redirect(
|
|
`https://login.xero.com/identity/connect/authorize?${params}`
|
|
);
|
|
}
|