From c7e3a74e7cb9a6d4c7b3f38bf253268c59c56c73 Mon Sep 17 00:00:00 2001 From: Arthur DANJOU Date: Sat, 15 Jan 2022 22:03:51 +0100 Subject: [PATCH] debug --- app/Utils/SongUtils.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Utils/SongUtils.ts b/app/Utils/SongUtils.ts index 44d2842..2085eb6 100644 --- a/app/Utils/SongUtils.ts +++ b/app/Utils/SongUtils.ts @@ -5,8 +5,10 @@ import Redis from '@ioc:Adonis/Addons/Redis' import { SpotifyArtist, SpotifyTrack } from 'App/Types/ILocalSpotify' import { Artist, InternalPlayerResponse, PlayerResponse, SpotifyToken } from 'App/Types/ISpotify' import Song from 'App/Models/Song' +import Logger from '@ioc:Adonis/Core/Logger' export function getSpotifyAccount(): { access: string; refresh: string } { + Logger.info(JSON.parse(readFileSync('spotify.json').toString())) return JSON.parse(readFileSync('spotify.json').toString()) } @@ -18,6 +20,7 @@ export function getAuthorizationURI(): string { redirect_uri: `${Env.get('BASE_URL')}/spotify/callback`, }) + Logger.info(`https://accounts.spotify.com/authorize?${query}`) return `https://accounts.spotify.com/authorize?${query}` } @@ -37,6 +40,8 @@ export async function setupSpotify(code: string): Promise { }, ) + Logger.info(String(authorization_tokens)) + if (authorization_tokens.status === 200) { writeFileSync( 'spotify.json', @@ -50,6 +55,7 @@ export async function setupSpotify(code: string): Promise { export async function regenerateTokens(): Promise { const refresh_token = getSpotifyAccount().refresh + Logger.info(refresh_token) const authorization_tokens: AxiosResponse = await axios.post( 'https://accounts.spotify.com/api/token', @@ -65,6 +71,7 @@ export async function regenerateTokens(): Promise { }, ) + Logger.info(String(authorization_tokens)) if (authorization_tokens.status === 200) { writeFileSync( 'spotify.json',