I am sending a get request to the google api to read the fitness estimated steps but it returns 401

29 Views Asked by At

I have a react page where I use google Sign in and I ask authorization to the activity scope of the user. after the user logged in I receive their acces token. So I send a get request with the access token to receive the data but it returns 401

this is the scope that I request for authorization 'https://www.googleapis.com/auth/fitness.activity.read'

`

function scopesRequest(){
        axios.get("https://www.googleapis.com/fitness/v1/users/me/dataSources/derived:com.google.step_count.delta:com.google.android.gms:estimated_steps/datasets/1690161161577-1694161161577", {
            headers: { 'Authorization': 'Bearer ' + token }
        })
        
        .then(function (response) {
          console.log(response);
        });
    }

Thanks in advance!

....................

0

There are 0 best solutions below