• 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 15 replies - 1 through 15 (of 23 total)
  • Plugin Author jrfoell

    (@jrfoell)

    Hey @sebastianerb – so you’re able to authorize your site with strava, but you see that error when you try to load a specific activity? Is there error from a widget or a shortcode or something else? Just trying to get some more specifics so I can look into it. Thanks!

    Plugin Author jrfoell

    (@jrfoell)

    @sebastianerb – I get this same error when I embed an activity with the [activity] shortcode (or the new Gutenberg block) but the plugin isn’t authenticated with the Strava API correctly. Are you on the latest version (v2.3.0)? Also, do you have multiple athletes set up or just yourself?

    I recommend making sure you’re on the latest version. Then clear your API connection from WordPress by going to Settings -> Strava and clearing out the Client ID and Nickname from the “Saved ID” row. Then check “Clear cache (images & transient data)” and click “Save Changes”.

    You should then be able to re-authenticate with Strava. Let me know if you’re still having trouble after these steps.

    Plugin Contributor sebastianerb

    (@sebastianerb)

    @jrfoell : sorry for late reply, I just didnt get the notification.
    Anyway: I am using the latest version and only have one athlete (mysqlf) configured.
    I tried to clear cache and reauthenticate like hundred times… its always the same.

    Plugin Author jrfoell

    (@jrfoell)

    Hey @sebastianerb – I just released 2.4.0. I found a case when upon re-authorization (after the temporary authorization key expired) that your authorization key could get accidentally deleted and “401 Unauthorized” was the result.

    Can you try out this latest version? Please re-open this if it doesn’t solve your issue. ??

    Plugin Contributor sebastianerb

    (@sebastianerb)

    @jrfoell : I just updated wp-strava and reauthorized the plugin with strava.

    Unfortunately its still the same:

    WP Strava ERROR 401 Unauthorized – See full error by adding
    define( ‘WPSTRAVA_DEBUG’, true );
    to wp-config.php

    Plugin Author jrfoell

    (@jrfoell)

    I just released v2.5.0 – can you give it another shot? I think the next move might be to remove rows in wp_options where option namme like ‘strava%’. I’m not sure if you have access to the database or not – let me know.

    Plugin Contributor sebastianerb

    (@sebastianerb)

    Hey @jrfoell,

    I updated to 2.5.0 and deleted all db rows with strava% in wp_options.
    After that I enabled debugging mode again and got the same error messages – its a mess :/

    I also got this in between:

    Warning: Invalid argument supplied for foreach() in <…>/wp-content/plugins/wp-strava/src/WPStrava/AuthRefresh.php on line 47

    Plugin Author jrfoell

    (@jrfoell)

    OK – I’m going to keep looking at this. Is your latest error the same as the one you pasted above?

    {"message":"Authorization Error","errors":[{"resource":"Application","field":"","code":"invalid"}]}

    Plugin Author jrfoell

    (@jrfoell)

    Hey @sebastianerb – someone else is having the same issue as you here: https://www.ads-software.com/support/topic/wp-not-saving-strava-settings/

    Are you still having issues? I’d like to help solve this problem.

    Looks like @sebastianerb gave up on solving this problem. How about you, @bartjanssen ?

    At https://thusgaard.com I seem to be having a similar issue. With debug set to true, this is what I get the text below. I should probably reauthenticate, but I’ve been looking around and I have no idea how:

    Warning: Invalid argument supplied for foreach() in /var/www/thusgaard.com/public_html/wp-content/plugins/wp-strava/src/WPStrava/AuthRefresh.php on line 47
    WP Strava ERROR Array
    (
        [headers] => Requests_Utility_CaseInsensitiveDictionary Object
            (
                [data:protected] => Array
                    (
                        [date] => Mon, 19 Jul 2021 14:01:56 GMT
                        [content-type] => application/json; charset=utf-8
                        [via] => 1.1 linkerd, 1.1 linkerd
                        [vary] => Origin
                        [server] => nginx/1.19.5
                        [status] => 401 Unauthorized
                        [x-request-id] => b78bd4cf-2082-4f46-8ec7-efff504e0945
                        [cache-control] => no-cache
                        [referrer-policy] => strict-origin-when-cross-origin
                        [x-frame-options] => DENY
                        [content-encoding] => gzip
                        [x-xss-protection] => 1; mode=block
                        [x-download-options] => noopen
                        [x-content-type-options] => nosniff
                        [x-permitted-cross-domain-policies] => none
                    )
    
            )
    
        [body] => {"message":"Authorization Error","errors":[{"resource":"Athlete","field":"access_token","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":"Athlete","field":"access_token","code":"invalid"}]}
                        [raw] => HTTP/1.1 401 Unauthorized
    Date: Mon, 19 Jul 2021 14:01:56 GMT
    Content-Type: application/json; charset=utf-8
    Transfer-Encoding: chunked
    Connection: close
    Via: 1.1 linkerd, 1.1 linkerd
    Vary: Origin
    Server: nginx/1.19.5
    Status: 401 Unauthorized
    X-Request-Id: b78bd4cf-2082-4f46-8ec7-efff504e0945
    Cache-Control: no-cache
    Referrer-Policy: strict-origin-when-cross-origin
    X-FRAME-OPTIONS: DENY
    content-encoding: gzip
    X-XSS-Protection: 1; mode=block
    X-Download-Options: noopen
    X-Content-Type-Options: nosniff
    X-Permitted-Cross-Domain-Policies: none
    
    {"message":"Authorization Error","errors":[{"resource":"Athlete","field":"access_token","code":"invalid"}]}
                        [headers] => Requests_Response_Headers Object
                            (
                                [data:protected] => Array
                                    (
                                        [date] => Array
                                            (
                                                [0] => Mon, 19 Jul 2021 14:01:56 GMT
                                            )
    
                                        [content-type] => Array
                                            (
                                                [0] => application/json; charset=utf-8
                                            )
    
                                        [via] => Array
                                            (
                                                [0] => 1.1 linkerd, 1.1 linkerd
                                            )
    
                                        [vary] => Array
                                            (
                                                [0] => Origin
                                            )
    
                                        [server] => Array
                                            (
                                                [0] => nginx/1.19.5
                                            )
    
                                        [status] => Array
                                            (
                                                [0] => 401 Unauthorized
                                            )
    
                                        [x-request-id] => Array
                                            (
                                                [0] => b78bd4cf-2082-4f46-8ec7-efff504e0945
                                            )
    
                                        [cache-control] => Array
                                            (
                                                [0] => no-cache
                                            )
    
                                        [referrer-policy] => Array
                                            (
                                                [0] => strict-origin-when-cross-origin
                                            )
    
                                        [x-frame-options] => Array
                                            (
                                                [0] => DENY
                                            )
    
                                        [content-encoding] => Array
                                            (
                                                [0] => gzip
                                            )
    
                                        [x-xss-protection] => Array
                                            (
                                                [0] => 1; mode=block
                                            )
    
                                        [x-download-options] => Array
                                            (
                                                [0] => noopen
                                            )
    
                                        [x-content-type-options] => Array
                                            (
                                                [0] => nosniff
                                            )
    
                                        [x-permitted-cross-domain-policies] => Array
                                            (
                                                [0] => none
                                            )
    
                                    )
    
                            )
    
                        [status_code] => 401
                        [protocol_version] => 1.1
                        [success] => 
                        [redirects] => 0
                        [url] => https://www.strava.com/api/v3/athlete/activities?&timeout=30
                        [history] => Array
                            (
                            )
    
                        [cookies] => Requests_Cookie_Jar Object
                            (
                                [cookies:protected] => Array
                                    (
                                    )
    
                            )
    
                    )
    
                [filename:protected] => 
                [data] => 
                [headers] => 
                [status] => 
            )
    
    )
    • This reply was modified 3 years, 4 months ago by gubbe.
    Plugin Author jrfoell

    (@jrfoell)

    @gubbe – I’d love to help, I just haven’t been able to reproduce this issue myself. Let me know if you can help me close this out.

    Sure, @jrfoell, how can I help?

    Plugin Contributor sebastianerb

    (@sebastianerb)

    @gubbe @jrfoell actually I really kind of resignated ?? Unfortunately the problem still exists and even with hours of debugging I wasn‘t able to spot the reason!

    • This reply was modified 3 years, 4 months ago by sebastianerb.
    • This reply was modified 3 years, 4 months ago by sebastianerb. Reason: typo

    How do I start from scratch? Uninstall, clear all data everywhere, reinstall, re-authenticate. I can’t seem to find out how, but I’ll do it with a little help.

    I’d say the problem is well-known. This search shows that a bunch of sites have at least the same error message.

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘WP Strava ERROR 401 Unauthorized’ is closed to new replies.