I created a service to connect with the Spotify API. When initializing this service in the constructor, it needs to retrieve the access token by subscribing to an Observable.
However, there's an issue:
The service is injected into my main component where I call its methods to fetch data from the Spotify API. I believe the problem lies in the fact that the access token has not been received before the initial request to the API attempts to use it.
Is there a way to ensure that the service is only injected after the constructor has successfully retrieved the access token?