Skip to content

Commit

Permalink
looks nice idk
Browse files Browse the repository at this point in the history
  • Loading branch information
DaXcess committed Oct 1, 2023
1 parent 43df1a5 commit 08bc4d1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pages/spotify/[token].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,16 @@ export const getServerSideProps = withSessionSsr(async ({ params, req }) => {

req.session.csrf_token = randomBytes(32).toString("hex");

const url = `https://accounts.spotify.com/authorize?client_id=${client_id}&response_type=code&redirect_uri=${encodeURIComponent(
process.env.SPOTIFY_REDIRECT_URI as string
)}&state=${encodeURIComponent(
`${token}:${req.session.csrf_token}`
)}&scope=${SCOPES.map((scope) => scope[0]).join("+")}&show_dialog=true`;
const params = new URLSearchParams({
response_type: "code",
client_id,
scope: SCOPES.map(([scope, ,]) => scope).join(","),
redirect_uri: process.env.SPOTIFY_REDIRECT_URI as string,
state: `${token}:${req.session.csrf_token}`,
show_dialog: "true",
});

const url = `https://accounts.spotify.com/authorize?${params.toString()}`;

await req.session.save();

Expand Down

0 comments on commit 08bc4d1

Please sign in to comment.