16 lines
470 B
TypeScript
16 lines
470 B
TypeScript
import { NextApiRequest, NextApiResponse } from 'next';
|
|
import { CLIENT_ID, OAUTH_URL, PUBLIC_URL } from '../../lib/constants';
|
|
|
|
export default function handler(req: NextApiRequest, res: NextApiResponse) {
|
|
const params = new URLSearchParams({
|
|
client_id: CLIENT_ID,
|
|
response_type: 'code',
|
|
redirect_uri: `${PUBLIC_URL}/api/callback`,
|
|
scope: 'management',
|
|
});
|
|
|
|
// TODO: generate state
|
|
|
|
res.redirect(`${OAUTH_URL}/authorize?${params.toString()}`);
|
|
}
|