javascriptnode.jstypescriptrestaxios

Polar Accesslink API 403


I successfully managed to implement the oauth flow for the polar accesslink api and have gotten an access token back however when I try and use the api I keep getting a 403 and I'm not sure what I'm doing wrong

    const {data} = await axios.get(
      'https://www.polaraccesslink.com/v3/users/continuous-heart-rate',
      {
        headers: {Accept: 'application/json', Authorization: `Bearer ${token}`},
        params: {
          from: moment(from).format('YYYY-MM-DD'),
          to: moment(to).format('YYYY-MM-DD'),
        },
      },
    );

Here's the link to the docs https://www.polar.com/accesslink-api/#get-continuous-heart-rate-samples-with-range


Solution

  • Never mind its because I needed to also call register user before making any other api calls https://www.polar.com/accesslink-api/#register-user