JoshLmao / Spotify4Unity

šŸŽ®šŸŽµ Add the SpotifyAPI.NET library into Unity, enabling access to the Spotify Web API, allowing for control of Spotify and accessing the world of music
https://assetstore.unity.com/packages/tools/integration/spotify4unity-ui-tools-spotify-authorization-129028
MIT License
97 stars 8 forks source link

doesn't work in macos #19

Closed eafzali closed 5 years ago

eafzali commented 5 years ago

Describe the bug Getting this error trying to run the example player:

Win32Exception: Cannot find the specified file
System.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo) (at <c9226b2f33b7421e85bb391f94075e49>:0)
System.Diagnostics.Process.Start () (at <c9226b2f33b7421e85bb391f94075e49>:0)
(wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start()
System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) (at <c9226b2f33b7421e85bb391f94075e49>:0)
SpotifyAPI.Web.Auth.AuthUtil.OpenBrowser (System.String url) (at D:/Development/SpotifyAPI-NET/SpotifyAPI.Web.Auth/AuthUtil.cs:30)
SpotifyAPI.Web.Auth.SpotifyAuthServer`1[T].OpenBrowser () (at D:/Development/SpotifyAPI-NET/SpotifyAPI.Web.Auth/SpotifyAuthServer.cs:79)
Spotify4Unity.SpotifyService.ConnectSpotifyWebHelper (SpotifyAPI.Web.Auth.AuthorizationCodeAuth auth, System.Int32 port) (at D:/Development/Spotify4Unity/Spotify4Unity/Spotify4Unity/SpotifyService.cs:129)
Spotify4Unity.SpotifyService.Connect () (at D:/Development/Spotify4Unity/Spotify4Unity/Spotify4Unity/SpotifyService.cs:115)
Spotify4Unity.SpotifyServiceBase.Start () (at D:/Development/Spotify4Unity/Spotify4Unity/Spotify4Unity/SpotifyServiceBase.cs:237)
Spotify4Unity.SpotifyService.Start () (at D:/Development/Spotify4Unity/Spotify4Unity/Spotify4Unity/SpotifyService.cs:70)

To Reproduce: Just run the example all_controls scene

Expected behavior I expect not receive that error I mentioned above and see your example controls instead. probably being redirected to Spotify login or something.

Platform: MacOS

Unity Version: 2019.1.7f1

JoshLmao commented 5 years ago

Hi,

Turns out this is an issue inside of SpotifyAPI.NET. I've done a quick fix for this (for now) and pushed an update to the store. I'll update the releases when it's live šŸ˜‰

eafzali commented 5 years ago

Thanks, I can confirm that now it works. but I ran into another issue which is now it connected and shows the current track info but it can't show my user info and saved tracks and also controller doesn't work. I have to say of course I had to take out UserReadBirthdate scope out in order to make it work, I was getting illegal scope error running the example scene.

JoshLmao commented 5 years ago

Hum, that sound strange. I know if you don't have premium you can only do all of the read-only operations. Is there any more messages or info? You can enable the logs and change the log level to All

eafzali commented 5 years ago

Ah, I see. Sorry, So I upgraded my I account and now controls work but still not able to load user profile data:

Spotify4Unity - Can't load Private Profile information of authorized user - System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.Collections.Generic.Dictionary`2+Enumerator[TKey,TValue].MoveNext () [0x00016] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Net.Http.Headers.HttpHeaders+<GetEnumerator>d__19.MoveNext () [0x000ac] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.Headers.HttpRequestHeaders.AddHeaders (System.Net.Http.Headers.HttpRequestHeaders headers) [0x00025] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000be] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage request) [0x00008] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.HttpClient.GetAsync (System.String requestUri) [0x0000c] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at SpotifyAPI.Web.SpotifyWebClient+<DownloadRawAsync>d__11.MoveNext () [0x0002c] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at SpotifyAPI.Web.SpotifyWebClient+<DownloadAsync>d__9.MoveNext () [0x0007e] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at SpotifyAPI.Web.SpotifyWebClient+<DownloadJsonAsync>d__13`1[T].MoveNext () [0x0007e] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at SpotifyAPI.Web.SpotifyWebAPI+<DownloadDataAsync>d__227`1[T].MoveNext () [0x00129] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at Spotify4Unity.SpotifyServiceBase+<LoadUserInformationAsync>d__81.MoveNext () [0x00078] in <fac514e7b7304f03b00d12145ddc0d3f>:0 
UnityEngine.Debug:LogError(Object)
Spotify4Unity.Analysis:LogError(String, LogLevel)
Spotify4Unity.<LoadUserInformationAsync>d__81:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(<LoadUserInformationAsync>d__81&)
Spotify4Unity.SpotifyServiceBase:LoadUserInformationAsync()
Spotify4Unity.<LoadUserInfo>d__80:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<LoadUserInfo>d__80&)
Spotify4Unity.SpotifyServiceBase:LoadUserInfo()
Spotify4Unity.<<InitializeService>b__67_0>d:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<<InitializeService>b__67_0>d&)
Spotify4Unity.SpotifyServiceBase:<InitializeService>b__67_0()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()
Spotify4Unity - Can't load Private Profile information of authorized user - System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
  at System.Collections.Generic.Dictionary`2+Enumerator[TKey,TValue].MoveNext () [0x00016] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Net.Http.Headers.HttpHeaders+<GetEnumerator>d__19.MoveNext () [0x000ac] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.Headers.HttpRequestHeaders.AddHeaders (System.Net.Http.Headers.HttpRequestHeaders headers) [0x00025] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000be] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.HttpClient.SendAsync (System.Net.Http.HttpRequestMessage request) [0x00008] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at System.Net.Http.HttpClient.GetAsync (System.String requestUri) [0x0000c] in <960ab25595cb4b1cb8c4959d26375323>:0 
  at SpotifyAPI.Web.SpotifyWebClient+<DownloadRawAsync>d__11.MoveNext () [0x0002c] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at SpotifyAPI.Web.SpotifyWebClient+<DownloadAsync>d__9.MoveNext () [0x0007e] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at SpotifyAPI.Web.SpotifyWebClient+<DownloadJsonAsync>d__13`1[T].MoveNext () [0x0007e] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at SpotifyAPI.Web.SpotifyWebAPI+<DownloadDataAsync>d__227`1[T].MoveNext () [0x00129] in <2e77cc7afb3c421fab8355f279b2031d>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at Spotify4Unity.SpotifyServiceBase+<LoadUserInformationAsync>d__81.MoveNext () [0x00078] in <fac514e7b7304f03b00d12145ddc0d3f>:0 
UnityEngine.Debug:LogError(Object)
Spotify4Unity.Analysis:LogError(String, LogLevel)
Spotify4Unity.<LoadUserInformationAsync>d__81:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:Start(<LoadUserInformationAsync>d__81&)
Spotify4Unity.SpotifyServiceBase:LoadUserInformationAsync()
Spotify4Unity.<LoadUserInfo>d__80:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<LoadUserInfo>d__80&)
Spotify4Unity.SpotifyServiceBase:LoadUserInfo()
Spotify4Unity.<<InitializeService>b__67_0>d:MoveNext()
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<<InitializeService>b__67_0>d&)
Spotify4Unity.SpotifyServiceBase:<InitializeService>b__67_0()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()

and what is that UserReadBirthdate I couldn't find it in https://developer.spotify.com/documentation/general/guides/scopes/

JoshLmao commented 5 years ago

I know that error would happen on older versions but I changed how reusing the auth is done which had fixed that. Are you targeting Mobile or PC? If you're using the MobileSpotifyService, try unchecking "Reuse Auth Token". Apart from that, I'm not sure on fixing that šŸ˜¬

Also afaik, the UserReadBirthday scope is an old scope got deprecated yet hasn't been removed from SpotifyAPI.NET. The scope that handles that now is "user-read-private"