How to Decode Session Tokens in Auth0 Actions

im sure its with the /continue action as that’s what the error indicates

but what I’ve been asking is how to do this in my nextjs app - send back the token in the right way validating it with jwt (if that is necessary) b/c that is the only difference with my redirect, other than the fact that i send a customer_id also in the final redirect

const validateIncomingToken = (req) => {
  if (!req.query || !req.query.session_token) {
    throw 'No session_token found'
  }

  try {
    const decoded = jwt.verify(req.query.session_token, SECRET)
    return decoded
  } catch (e) {
    throw 'Invalid session_token'
  }
}

/*
 * Generate new session token to be sent to Auth0
 */
const generateNewToken = (data, state) => {
  const payload = {
    sub: data.sub, // Mandatory, must match incoming token's sub
    iss: 'my-redirect-app', // Optional, not validated
    state, // Mandatory, validated by Auth0
    color: 'blue', // Optional custom parameters to be used in Actions
  }
  // Even though iat and exp are not added above, they are implicitly added by the jwt library

  const token = jwt.sign(payload, SECRET, { expiresIn: '60s' })
  return token
}

app.get('/redirect', (req, res) => {
  try {
    const incomingData = validateIncomingToken(req)

    const newToken = generateNewToken(incomingData, req.query.state)

    const url = `https://${TENANT_DOMAIN}/continue?state=${req.query.state}&my_token=${newToken}`

    res.redirect(url)
  } catch (e) {
    res.send(e)
  }
})

does this make a difference and if so how could i implement that into my checkou.tsx page:

import React from 'react';
import { useAuth0 } from '@auth0/auth0-react';
import Stripe from 'stripe';
import queryString from 'query-string';
import jwt from 'jsonwebtoken'; // Import the JWT library

const stripe = new Stripe('******************************', {
  apiVersion: '2022-11-15',
});

const Checkout = () => {
  const { user } = useAuth0();
  const priceId = '*******************';
  const successUrl = 'https://***********.us.auth0.com/continue';
  const cancelUrl = 'https://www.searchecomm.com/about';

  async function createCheckoutSession() {
    // Parse the URL to get state, session_token, customer_id, and redirect_uri
    const parsedUrl = queryString.parse(window.location.search);
    const sessionToken = parsedUrl.session_token as string;
    //const customerId = parsedUrl.customer_id;
    const redirectUri = parsedUrl.redirect_uri;
    const state = parsedUrl.state;
    const customerId = parsedUrl.customer_id as string;


    // Check if the session_token, customer_id, and redirectUri exist
    if (sessionToken && redirectUri && customerId) {
      const decodedToken = jwt.decode(sessionToken);
      if(!decodedToken){
        console.log('not decoding properly')
      }
      // Validate the decoded token (check expiration, etc.)
      // Note: You might need to adjust the validation logic based on your token structure
      //if (decodedToken) {
        const newURI = `${successUrl}?session_token=${sessionToken}`;      
          const session = await stripe.checkout.sessions.create({
          customer: customerId,
          payment_method_types: ['card'],
          line_items: [{ price: priceId, quantity: 1 }],
          subscription_data: {
            trial_period_days: 5
          },
          mode: 'subscription',
          success_url: newURI,
          cancel_url: cancelUrl,
        });

        if (session.url) {
          window.location.href = session.url; // Redirect to Stripe checkout page
        }
      //} else {
      //  console.error('Invalid or expired session token');
        // Handle the case where the session token is invalid or expired
      //}
    }
  }

  return (
    <div>
      <br></br><br></br><br></br>
      <button onClick={createCheckoutSession}>Click Here To Checkout For Our ********* Plan!</button>
    </div>
  );
};