Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/main/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let onTokenRetrieved: (data: AuthData) => void = null;

const AUTH_URL = 'https://accounts.spotify.com/authorize';
const AUTH_TOKEN_URL = 'https://accounts.spotify.com/api/token';
const AUTH_CLIENT_ID = '69eca11b9ccd4bd3a7e01e6f9ddb5205';
const AUTH_CLIENT_ID = '8a501eb93a49490589ee2ca4a25615f5';
const AUTH_PORT = 41419;
const AUTH_SCOPES = [
'user-read-playback-state',
Expand Down Expand Up @@ -49,7 +49,7 @@ export const getAuthUrl = (): string => {
const scopes = AUTH_SCOPES.join('%20');

const authUrl =
`${AUTH_URL}?response_type=code&client_id=${AUTH_CLIENT_ID}&redirect_uri=http://localhost:${AUTH_PORT}&` +
`${AUTH_URL}?response_type=code&client_id=${AUTH_CLIENT_ID}&redirect_uri=http://127.0.0.1:${AUTH_PORT}&` +
`scope=${scopes}&state=${codeState}&code_challenge=${codeChallenge}&code_challenge_method=S256`;

return authUrl;
Expand Down Expand Up @@ -120,7 +120,7 @@ const retrieveAccessToken = async (verifier: string, code: string): Promise<Auth

const body =
`client_id=${AUTH_CLIENT_ID}&grant_type=authorization_code&` +
`code=${code}&redirect_uri=http://localhost:${AUTH_PORT}&code_verifier=${verifier}`;
`code=${code}&redirect_uri=http://127.0.0.1:${AUTH_PORT}&code_verifier=${verifier}`;

const res = await fetch(AUTH_TOKEN_URL, {
method: 'POST',
Expand Down Expand Up @@ -149,7 +149,7 @@ const stopServer = (): void => {
};

const handleServerResponse = async (request: http.IncomingMessage, response: http.ServerResponse): Promise<void> => {
const urlObj = new URL(`http://localhost:${AUTH_PORT}/${request.url}`);
const urlObj = new URL(`http://127.0.0.1:${AUTH_PORT}/${request.url}`);
const queryState = urlObj.searchParams.get('state');

try {
Expand Down