Spaces:
Runtime error
Runtime error
File size: 633 Bytes
53bff8d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
export default function handler(req, res) {
const { clientId, redirectUri } = req.body;
if (!clientId) {
return res.status(400).json({ error: 'Missing Client ID' });
}
const scopes = [
'user-read-private',
'user-read-email',
'user-top-read',
'user-library-read',
'playlist-read-private'
];
const params = new URLSearchParams({
client_id: clientId,
response_type: 'code',
redirect_uri: redirectUri,
scope: scopes.join(' '),
show_dialog: true
});
const authUrl = `https://accounts.spotify.com/authorize?${params.toString()}`;
res.status(200).json({ url: authUrl });
} |