Error when trying to set up Forge Remote

Following the example app, I am trying to set up Forge Remote with a hosted server. However, before any request hits the server, I am getting this error:

Error: Remote could not verify the Forge Invocation Token

I combed through the stack trace and it seems it fails in the getCallBridge function of @forge/bridge but I can’t figure out why.

Here is the code:

import React, {useEffect, useState} from 'react';
import ForgeReconciler, { Inline } from '@forge/react';
import { invokeRemote } from '@forge/bridge';

const App = () => {
  const [data, setData] = useState<any>(null);
  useEffect(() => {
    invokeRemote({
      method: 'POST',
      path: '/test'
    }).then(res => {
      console.log("RESPONSE")
      setData(res);
    })
  }, []);
  if (data) {
    const res = data.body;
    return (
      <>
        <Inline> Remote results:</Inline>
          <Inline> {res.test ? 'Test success!' : 'Test fail :('}</Inline>
      </>
    );

  }
  return (
    <Inline>Performing Remote Invocation...</Inline>
  )
};
ForgeReconciler.render(
    <App />
);

Bump - still having this issue.

Hi @MattGudenas,
You normally run into this error when your remote server returns a 401 from the invocation request. Can you please check the behaviour of your remote server and make sure that you are validating remote requests correctly, here is a link to the documentation

1 Like