Jump to content

Forum REST API logs not showing HTTP Status 403 errors


Recommended Posts

Hi Developer Team,

On our production forum user login, we have an Auth0 post login flow to get user details from Forum through the GET core/members. This is the code for the Populate forum user data on login:

* Handler that will be called during the execution of a PostLogin flow.
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
const axios = require("axios");
exports.onExecutePostLogin = async (event, api) => {
const namespace = '<CG API URL>';
const forumURL = 'https://forum.casinogrounds.com';
api.accessToken.setCustomClaim(`${namespace}/avatar`, event.user.picture);
api.accessToken.setCustomClaim(`${namespace}/email`, event.user.email);
api.accessToken.setCustomClaim(`${namespace}/username`, event.user.username);
const url = `${forumURL}/api/core/members?key=${event.secrets.forumApiKey}&email=${encodeURIComponent(event.user.email)}`;
// console.log('url: ', url);
const forumUserData = await axios.get(url, {
headers: {
'User-Agent': 'auth0-action-populate-forum-user-data',
if (forumUserData.status === 200 && forumUserData.data.results && forumUserData.data.results.length > 0 && forumUserData.data.results[0].email === event.user.email) {
api.accessToken.setCustomClaim(`${namespace}/forum_user_profile_url`, forumUserData.data.results[0].profileUrl);
api.accessToken.setCustomClaim(`${namespace}/forum_user_photo_url`, forumUserData.data.results[0].photoUrl);
api.accessToken.setCustomClaim(`${namespace}/forum_user_name`, forumUserData.data.results[0].name);

From Auth0, we are receiving a 403 status error from Forum but on the REST API logs I am only seeing 200, 201 and 404 errors. The error from Auth0 is the following: 

   "action_name":"Populate forum user data on login",
         "message":"Request failed with status code 403",
         "stack":"AxiosError: Request failed with status code 403\n    at settle (/data/layers/layers-zfDn/zfDngH1yU51TNG8pkEdFfEpUsA11xFgdd1aUUCXYbl8/node_modules/axios/dist/node/axios.cjs:1900:12)\n    at IncomingMessage.handleStreamEnd (/data/layers/layers-zfDn/zfDngH1yU51TNG8pkEdFfEpUsA11xFgdd1aUUCXYbl8/node_modules/axios/dist/node/axios.cjs:2952:11)\n    at IncomingMessage.emit (node:events:539:35)\n    at IncomingMessage.emit (node:domain:537:15)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"
      "msg":"Invalid Argument"

In the above the key is the following 

      "msg":"Invalid Argument"

But since the status is 403 not 400, kindly could you please let us know what is missing or not done correctly please?

Thanks and regards,

Neville Camilleri


Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...