Trouble authenticating a request from a POS UI extension

Hi,

I’ve been trying to authenticate a request from a POS UI extension to my Remix app.

I want to use:

const { admin } = await authenticate.public.appProxy(request);

or:

const { admin } = await authenticate.admin(request);

In my POS UI extension, I’m able to get the session token:

const [sessionToken, setSessionToken] = useState<string | null | undefined>(
    null,
  );

  useEffect(() => {
    getSessionToken().then((token) => {
      setSessionToken(token);
    });
  }, [shopDomain, getSessionToken]);

But I cannot find any details about authenticating the request.
If I’m using it as a Bearer token, I get:

shopify-app/INFO] Query does not contain a signature value

And if I don’t use any, I get an empty error.

What do I do wrong ?

Actually, here was the solution:

Use the session_token and pass it as a Bearer in the fetch request.

On remix, use:

const session = await authenticate.admin(request);

But, in case of any error, I use:

const decoded = jwt.verify(token, process.env.SHOPIFY_API_SECRET!, {
algorithms: ["HS256"],
});