Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

POST 401 Authorization Error on Revoke Endpoint

ANSWERED

Hey All and Gordon,

 

I am trying to revoke an access token following the recent header requirements post and the documentation

 

My TS function is

 

    var params = "token=" + this.fitbitToken; //grabs properly from firebase
    var xhr = new XMLHttpRequest();
    xhr.open('POST''https://api.fitbit.com/oauth2/revoke');
    xhr.setRequestHeader("Authorization"'Basic [BASE64 Encoded (client_id):(client_secret)')];
    xhr.setRequestHeader("Content-Type""application/x-www-form-urlencoded");
    xhr.onload = function () {
        if (xhr.status === 200) {
            console.log("SUCCESS")
            console.log(xhr.responseText)
        }
    };
    xhr.send(params);
  }
 
I have not included the content length new header requirements as that will not be implemented till May, but am still receiving a 401 error.
 
Any advice on how to fix this error? Thanks!

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Resolved!

 

Had to look into the HTML response (which I thought I had done previously) to see that I was sending a bad token.

 

I diagnosed this by getting the client access_token once again and manually pasting it into my code.

View best answer in original post

Best Answer
0 Votes
1 REPLY 1

Resolved!

 

Had to look into the HTML response (which I thought I had done previously) to see that I was sending a bad token.

 

I diagnosed this by getting the client access_token once again and manually pasting it into my code.

Best Answer
0 Votes