[Spotify Player] I am always required to sign in
Extension
https://www.raycast.com/mattisssa/spotify-player
Description
Everytime I try to use a command, it requires me to sign in.
Steps To Reproduce
Download extension Log in (authenticate) Approve Done Next time i need to use command, it asks to authenticate again
Current Behaviour
No response
Expected Behaviour
No response
Thank you for opening this issue!
🔔 @mattisssa @peduarte @sxn @dillionverma @andreaselia @stuart @tonka3000 @dancannon @pernielsentikaer @stevensd2m @erics118 @hjoelh @hobhouse @bkeys818 @jatindotdev you might want to have a look.
💡 Author and Contributors commands
The author and contributors of mattisssa/spotify-player can trigger bot actions by commenting:
@raycastbot close this issueCloses the issue.@raycastbot rename this issue to "Awesome new title"Renames the issue.@raycastbot reopen this issueReopen the issue.
I have that same issue and it's annoying.
Hey, can you provide more details please? Steps to reproduce and/or a video recording? We are unable to reproduce.
Hey, can you provide more details please? Steps to reproduce and/or a video recording? We are unable to reproduce.
I have been using the plugin the last four days and it required me to sign-in 5 Times already... I'm normally using my Mac and not touching anything related to the Plugin, however the red Cautionmark still pops up after a while
This is the Error, I am getting:
{"_isRayError":true,"code":16,"title":"Could not initialize OAuth","name":"Error","message":"OAuth request creation is not available when command is launched in background","stack":"Error: OAuth request creation is not available when command is launched in background\n at Rr (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:25:230)\n at Ye (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:24:6249)\n at ht (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:24:6374)\n at Immediate.<anonymous> (/Applications/Raycast.app/Contents/Resources/RaycastCommands_RaycastCommands.bundle/Contents/Resources/api/node_modules/@raycast/server/index.js:24:6139)\n at process.processImmediate (node:internal/timers:478:21)","breadcrumbs":[{"level":"debug","category":"Request","message":"","timestamp":"2024-02-02T15:51:37.828Z","data":{"function":"getApplications"}}]}:
(Sorry for bad formatting :D)
Oh ok, that's certainly not expected behaviour :/ is there anything else you could share, perhaps whether you're using a vpn?
@sxn can you think of any reason why this may happen to this specific user?
not sure 🤔 @Evolinox what version of Raycast are you using? and – did the menu bar command work after you logged in? could you see the currently playing song for a while, only to then later have it stop working?
Oh ok, that's certainly not expected behaviour :/ is there anything else you could share, perhaps whether you're using a vpn?
@sxn can you think of any reason why this may happen to this specific user?
Can't share much more, i think :/ I didn't use a VPN at all.
not sure 🤔 @Evolinox what version of Raycast are you using? and – did the menu bar command work after you logged in? could you see the currently playing song for a while, only to then later have it stop working?
I am currently using Version 1.66.2. The Menubar Command works fine for atleast an hour... when i come back to my Mac, it has logged out and displays the red danger icon. Maybe it has to do with the Standby Mode?
I know that sometimes when I login after my laptop's been asleep, i see the reed triangle too while it's connecting to the wifi. but once it connects, it goes away and I dont need to sign in again. fwiw ive been using this extension for months. so this is so weird.
have you tried uninstalling the extension and installing it again?
Just wanted to circle back here. I travelled to a country where the Spotify service is not available – I could still use Spotify on my devices though, but the extension was forcing me to sign in. I have since returned to South Africa and its not caused me problems yet. So I will monitor it this week and report back.
have you tried uninstalling the extension and installing it again?
Yes, ive done this twice already, but its still happening.
I travelled to a country where the Spotify service is not available – I could still use Spotify on my devices though, but the extension was forcing me to sign in.
I'm from/in Germany, where Spotify is fully available afaik.
Same on my end unfortunately
Same here. Anyone working on this?
I’ve noticed that it stays signed in if I enable “Hide icon when idle” in the settings for Menu Bar Player. It might be something to do with Oauth not being able to make requests in the background.
I retract my previous comment. "Hide icon when idle" doesn't seem to make a difference; the extension continues to log out at least once a day.
Yeah, have the same issue.
I’ve noticed that it stays signed in if I enable “Hide icon when idle” in the settings for Menu Bar Player. It might be something to do with Oauth not being able to make requests in the background.
For me... it seemed to resolve it. Since I disabled the "mane bar player" in the settings completely I've stayed logged in
https://github.com/raycast/extensions/tree/4367e1f447712d070bfe44e5f2b9d4ad5b408cac/extensions/spotify-player/
This version works perfectly for me. Installed it locally and with the menu bar player everything works fine. There must be something broken in between then with the OAuth Configuration and the menu bar player.
same issue here 👍🏻
Deactivating the menu bar player seems to solve the signing out problem.
any fixes to use the menu bar player?
any fixes to use the menu bar player?
Nope, it still happens
This issue has been automatically marked as stale because it did not have any recent activity.
It will be closed if no further activity occurs in the next 10 days to keep our backlog clean 😊
There is nothing to close here - This is still an issue. Please DON'T CLOSE!
No updates here guys?
I know this is non-profit. But this has been an issue for months now. Isn't it relatively easy to fix?
Such a nice little feature – like everything else Raycast.
Please fix
Getting a similar issue. Commenting to follow, this has never happened until a week or so ago
I've noticed the same behavior for the past couple of weeks, but I'm not sure if it's connected to the extension 🤔
I am playing around with modifying the setSpotifyClient function to include a network check and retry logic. Rebuilt the plugin and installed it. It's been 24 hours and the plugin hasn't lost its (freshly authorized) Oauth token, so we'll see if this continues. FWIW this was a quick hack and this is most def not implemented ideally! BTW the menu bar is enabled and working which was problematic before. Waiting for it to ask for Spotify auth again tho. lolz
import { showHUD } from "@raycast/api";
export async function setSpotifyClient() {
const isConnected = await checkNetworkConnectivity();
if (!isConnected) {
await showHUD("Network is not available. Please check your VPN connection.");
return;
}
let retries = 3;
while (retries > 0) {
try {
const accessToken = await provider.authorize();
api.defaults.headers = {
Authorization: `Bearer ${accessToken}`,
};
api.defaults.fetch = nodeFetch as any;
spotifyClient = api;
return;
} catch (error) {
console.error("Error during authentication:", error);
retries--;
if (retries === 0) {
await showHUD("Failed to authenticate with Spotify. Please try again.");
throw error;
}
await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds before retrying
}
}
}
async function checkNetworkConnectivity() {
try {
await fetch('https://api.spotify.com', { method: 'HEAD', mode: 'no-cors' });
return true;
} catch (error) {
return false;
}
}
24 Hour Update: It’s still working. Whatever I did seems to be holding up, although it looks like I have the extension installed twice (probably the local dev version and the original one I installed). In the settings, the Raycast version shows two Spotify login buttons, while the dev version only has one.
I am playing around with modifying the setSpotifyClient function to include a network check and retry logic. Rebuilt the plugin and installed it. It's been 24 hours and the plugin hasn't lost its (freshly authorized) Oauth token, so we'll see if this continues. FWIW this was a quick hack and this is most def not implemented ideally! BTW the menu bar is enabled and working which was problematic before. Waiting for it to ask for Spotify auth again tho. lolz
import { showHUD } from "@raycast/api"; export async function setSpotifyClient() { const isConnected = await checkNetworkConnectivity(); if (!isConnected) { await showHUD("Network is not available. Please check your VPN connection."); return; } let retries = 3; while (retries > 0) { try { const accessToken = await provider.authorize(); api.defaults.headers = { Authorization: `Bearer ${accessToken}`, }; api.defaults.fetch = nodeFetch as any; spotifyClient = api; return; } catch (error) { console.error("Error during authentication:", error); retries--; if (retries === 0) { await showHUD("Failed to authenticate with Spotify. Please try again."); throw error; } await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds before retrying } } } async function checkNetworkConnectivity() { try { await fetch('https://api.spotify.com', { method: 'HEAD', mode: 'no-cors' }); return true; } catch (error) { return false; } }24 Hour Update: It’s still working. Whatever I did seems to be holding up, although it looks like I have the extension installed twice (probably the local dev version and the original one I installed). In the settings, the Raycast version shows two Spotify login buttons, while the dev version only has one.
![]()
I'd say go for the PR to fix this finally?
Are there any updates on a fix for this? I just linked a number of related issues, this still seems to be an ongoing problem for many (including myself)
