question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code never hits AuthOnAuthReceived

See original GitHub issue

Hi Johnny,

been at this all day, lol as you can see from a previous issue. So I pulled your code from the example and my code never hits the AuthOnAuthReceived function which i believe it needs to to get the actual access token. The code that comes back in the query doesn’t seem to work in terms of giving me the access I need. my client id and client secret are being pulled in from AWS secrets manager without an issue. I can step through and see that they are there.

` public void AuthorizeSpotify() {

        AuthorizationCodeAuth auth = new AuthorizationCodeAuth(clientId, clientSecret, "https://localhost:5001", "https://localhost:5001", Scope.Streaming | Scope.UserReadBirthdate | Scope.UserModifyPlaybackState | Scope.UserReadEmail | Scope.UserReadPrivate | Scope.UserReadPlaybackState | Scope.UserReadCurrentlyPlaying | Scope.UserReadRecentlyPlayed);
        auth.AuthReceived += AuthOnAuthReceived;
        auth.Start();
        auth.OpenBrowser();
        auth.Stop(0);
    }

`

` private async void AuthOnAuthReceived(object sender, AuthorizationCode payload) {

        AuthorizationCodeAuth auth = (AuthorizationCodeAuth) sender;
        auth.Stop();
        token = await auth.ExchangeCode(payload.Code);
        spotify = new SpotifyWebAPI
        {
            AccessToken = token.AccessToken,
            TokenType = token.TokenType
        };
        PrintUsefulData(spotify);
    }

`

When my front end triggers the first method, here is the url string I receive back: https://localhost:5001/?code=AQACfDUpM-V9PAxMttgPZ4eTV43XjhKIdB3tihgMvLxIZnuURZeVBsjTtS_T4mOPNdgsqVmrKUFXBT4cQjipoQpfM6iKMPyw_qcDH9ZvBoiJ29tRpk4LJLhdcwfcOKVVRzni9LU6XBYhpGf9eploP5zFtYWUzZcvxr4KrxUv0cx-Qc39X6wGwK4WL8dfzpcHSWfEh7NEnlHxqdFvX8GW8q5jThThcq1KRVuJ5p2L7v1WJKJavEmA2-l7BgNdAOmqB40Fiu2MrIxCvvjwbIHJ-GEl_GrWn8k3lo506GjSb7Y6plQYo3yoszC5xpfY1H2LqNiweke2e_zIuPOdxkslhxrp_wDirKT9QrBDajZ2OBGhKKFSHL8oUfchedFT5_UYpW7pgjnDAXQ8g5eEVLq1mxjDi667skqzZCmLkP9WIt8&state=3eed7400

but it never hits the other method and i know that code ^ is unauthorized. What am i doing wrong?!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JohnnyCrazycommented, Oct 16, 2018

Did you get it working @kneekey23 ?

0reactions
bvanrijncommented, Oct 19, 2019

My problem was that I had the NoScript extension enabled for localhost, meaning the inline script it uses to pass the token back was never executed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git authentication with GitHub fails, remote: No anonymous ...
Go to settings in Visual Studio Code; find Git: Terminal Authentication, and deselect it; run git config --global credential.helper 'cache ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found