• Plugin Contributor sebastianerb

    (@sebastianerb)


    WP Strava ERROR 401 Unauthorized – See full error by adding
    define( ‘WPSTRAVA_DEBUG’, true );

    After enabling WPSTRAVA_DEBUG I have this additional information:

    WP Strava ERROR Array
    (
        [headers] => Requests_Utility_CaseInsensitiveDictionary Object
            (
                [data:protected] => Array
                    (
                        [date] => Wed, 13 May 2020 11:32:31 GMT
                        [content-type] => application/json; charset=utf-8
                        [cache-control] => no-cache
                        [via] => 1.1 linkerd
                        [x-download-options] => noopen
                        [status] => 401 Unauthorized
                        [x-request-id] => **************************
                        [referrer-policy] => strict-origin-when-cross-origin
                        [x-frame-options] => DENY
                        [x-permitted-cross-domain-policies] => none
                        [x-content-type-options] => nosniff
                        [vary] => Origin
                        [x-xss-protection] => 1; mode=block
                        [content-encoding] => gzip
                    )
    
            )
    
        [body] => {"message":"Authorization Error","errors":[{"resource":"Application","field":"","code":"invalid"}]}
        [response] => Array
            (
                [code] => 401
                [message] => Unauthorized
            )
    
        [cookies] => Array
            (
            )
    
        [filename] => 
        [http_response] => WP_HTTP_Requests_Response Object
            (
                [response:protected] => Requests_Response Object
                    (
                        [body] => {"message":"Authorization Error","errors":[{"resource":"Application","field":"","code":"invalid"}]}
                        [raw] => HTTP/1.1 401 Unauthorized
    Date: Wed, 13 May 2020 11:32:31 GMT
    Content-Type: application/json; charset=utf-8
    Transfer-Encoding: chunked
    Connection: close
    Cache-Control: no-cache
    Via: 1.1 linkerd
    X-Download-Options: noopen
    Status: 401 Unauthorized
    X-Request-Id: ***********************
    Referrer-Policy: strict-origin-when-cross-origin
    X-FRAME-OPTIONS: DENY
    X-Permitted-Cross-Domain-Policies: none
    X-Content-Type-Options: nosniff
    Vary: Origin
    X-XSS-Protection: 1; mode=block
    content-encoding: gzip
    
    {"message":"Authorization Error","errors":[{"resource":"Application","field":"","code":"invalid"}]}
                        [headers] => Requests_Response_Headers Object
                            (
                                [data:protected] => Array
                                    (
                                        [date] => Array
                                            (
                                                [0] => Wed, 13 May 2020 11:32:31 GMT
                                            )
    
                                        [content-type] => Array
                                            (
                                                [0] => application/json; charset=utf-8
                                            )
    
                                        [cache-control] => Array
                                            (
                                                [0] => no-cache
                                            )
    
                                        [via] => Array
                                            (
                                                [0] => 1.1 linkerd
                                            )
    
                                        [x-download-options] => Array
                                            (
                                                [0] => noopen
                                            )
    
                                        [status] => Array
                                            (
                                                [0] => 401 Unauthorized
                                            )
    
                                        [x-request-id] => Array
                                            (
                                                [0] => 1bc24f39-7fcf-47e7-a98e-a23279041391
                                            )
    
                                        [referrer-policy] => Array
                                            (
                                                [0] => strict-origin-when-cross-origin
                                            )
    
                                        [x-frame-options] => Array
                                            (
                                                [0] => DENY
                                            )
    
                                        [x-permitted-cross-domain-policies] => Array
                                            (
                                                [0] => none
                                            )
    
                                        [x-content-type-options] => Array
                                            (
                                                [0] => nosniff
                                            )
    
                                        [vary] => Array
                                            (
                                                [0] => Origin
                                            )
    
                                        [x-xss-protection] => Array
                                            (
                                                [0] => 1; mode=block
                                            )
    
                                        [content-encoding] => Array
                                            (
                                                [0] => gzip
                                            )
    
                                    )
    
                            )
    
                        [status_code] => 401
                        [protocol_version] => 1.1
                        [success] => 
                        [redirects] => 0
                        [url] => https://www.strava.com/api/v3/activities/1343834900
                        [history] => Array
                            (
                            )
    
                        [cookies] => Requests_Cookie_Jar Object
                            (
                                [cookies:protected] => Array
                                    (
                                    )
    
                            )
    
                    )
    
                [filename:protected] => 
                [data] => 
                [headers] => 
                [status] => 
            )
    
    )

    I have tried to reauthorize it a several times and it always says:

    New Strava token retrieved. Successfully authenticated.

    Also deleting and reinstalling the Plugin did not help.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 16 through 23 (of 23 total)
  • For good measure switched off all plugins and tested if that had an impact. Made no difference.

    Is it possible to find the authorization code somewhere in the database or wordpress installation ?

    So, I just:
    1) removed the Saved ID and the Client Secret.
    2) Clicked Save
    3) Deleted the Cache
    4) Clicked Save
    5) Reinserted the saved ID and the client secret
    6) Clicked Save
    7) Received “New Strava token retrieved. Successfully authenticated.”

    …and still it doesn’t work.

    Plugin Author jrfoell

    (@jrfoell)

    @gubbe good find on that search. You can see all of the strava settings in the DB by running this mysql query:

    select * from wp_options where option_name like '%strava%';

    The auth tokens will be saved in the option strava_info if they were successfully saved. Maybe you can paste the contents from your DB? If you have access to WP-CLI the command you can run is:

    
    $ wp option get strava_info
    array (
      6036 => 
      (object) array(
         'token_type' => 'Bearer',
         'access_token' => '<access token hash>',
         'expires_at' => 1632514708,
         'expires_in' => 21600,
         'refresh_token' => '<refresh token hash>',
         'client_secret' => '<secret hash>',
      ),
    )
    
    Plugin Author jrfoell

    (@jrfoell)

    Hey @gubbe – I made a GitHub ticket for this issue https://github.com/cmanon/wp-strava/issues/109

    We can move our conversation there if you’d like, or keep it here if you’re not on GitHub. FYI WP.org automatically archives support threads after a while which is a bummer.

    Thanks again for showing me all the other sites that are having the same issue. I added some code to the 2.10.0 release to hopefully debug this issue and I’m glad you’re able to help out.

    Can you set the following settings in your wp-config.php?:

    
    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );
    define( 'WPSTRAVA_DEBUG', true );
    

    That should create a wp-content/debug.log file when errors are reported. Once you’ve got the “New Strava token retrieved. Successfully authenticated.” message, you can use wp-cli to force-run the cron:

    wp cron event run wp_strava_auth_refresh_cron

    Hopefully something useful will be in the logs saying “strava_info should be an array, received: X”

    • This reply was modified 3 years, 5 months ago by jrfoell. Reason: Added debug log message
    Plugin Author jrfoell

    (@jrfoell)

    @gubbe I got lots of time to spend on this today ?? Following your procedure for removing saved ID and secret, I did find some old data laying around. I went through the process and made some tweaks to keep the client ID / secret / nickname all in sync. If you can check out 2.10.1 and let me know it would be great.

    Alright, @jrfoell, I’m following you over on Github to make sure we can continue the chat about this bug (and for future bug reporting).

    Plugin Author jrfoell

    (@jrfoell)

    @gubbe – in case you’re not getting github notifications, I posted an update there: https://github.com/cmanon/wp-strava/issues/109

    • This reply was modified 3 years, 3 months ago by jrfoell.
Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘WP Strava ERROR 401 Unauthorized’ is closed to new replies.