Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
No se pueden obtener los datos de ajuste de Google en la aplicación de reacción: error 400, 401

Estoy tratando de obtener datos diarios de google fit api, pero no entiendo qué está mal en mi solicitud. Estoy tratando de obtener el conteo diario de pasos, pero sigo recibiendo el error 401. Aquí está todo el código implementado y solo estoy tratando de registrar la respuesta.

 const [user, setUser] = useState({ haslogin: false, accessToken: "" }); function login(response) { if (response.wc.access_token) { setUser({ ...response.profileObj, haslogin: true, accessToken: response.wc.access_token, }); } } function logout(response) { setUser({ haslogin: false, accessToken: "" }); } function handleLoginFailure(response) { alert("Failed to log in"); } function handleLogoutFailure(response) { alert("Failed to log out"); } const handleData = () => { Axios.post( "https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate", { aggregateBy: [ { dataTypeName: "com.google.step_count.delta", dataSourceId: "derived:com.google.step_count.delta:com.google.android.gms:estimated_steps", }, ], bucketByTime: { durationMillis: 86400000 }, startTimeMillis: 1438705622000, endTimeMillis: 1439310422000, }, { params: { key: API_KEY, }, headers: { Authorization: `Bearer ${user.accessToken}`, Accept: "application/json", }, } ) .then((response) => { console.log("res", response); }) .catch((err) => console.log(err)); };

¿Alguien puede ayudarme con este problema?

Gracias

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!