Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

insufficient Permissions error facing also not able to find out View ID

Hello I am doing one task there I need to fetch my google analytic data into my node Js application. I have done the basic things currently I am having this issue 


{
    "code": 403,
    "message": "User does not have sufficient permissions for this profile.",
    "errors": [
        {
            "message": "User does not have sufficient permissions for this profile.",
            "domain": "global",
            "reason": "insufficientPermissions"
        }
    ]
}

I have also check the permission is read/write but its still not working can you help me with the same 

Using this way to fetch data 

const GetViewsData = async (req, res) => {
  try {
    await jwtNew.authorize();

    const response = await google.analytics("v3").data.ga.get({
      auth: jwtNew,
      ids: "ga:" + view_id,
      'start-date': '30daysAgo',
      'end-date': 'today',
      'metrics': 'ga:pageviews'
    });

    res.json({
      success: 1,
      message: "success",
      data: response,
    });
  } catch (err) {
    res.json({
      ...err?.response?.data?.error,
    });
  }
};

also I have try to fetch VIEW ID using property ID but there I am also fasing issue 

Thanks

1 22 29.6K
22 REPLIES 22