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

How to get x-gcp-marketplace-token in my ReactJS signup page?

I'm developing a Google Marketplace Saas Integration currently .

I'm stuck in the frontend integration as of now . Reference : https://cloud.google.com/marketplace/docs/partners/integrated-saas/frontend-integration

I've created 2 pages using ReactJS i.e. Signup page and Login page and deployed my frontend code .

kZ7MKucb.png

As we can see from the above doc snippet " When they click the button, Google Cloud sends an HTTP POST request to your sign up page, with a JSON Web Token (JWT) in the x-gcp-marketplace-token parameter. "

Google Cloud makes an HTTP POST request to my signup page ? How do I get this x-gcp-marketplace-token that Google is sending in my Signup page ???

App.jsx file code:

import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Signup from "./pages/Signup/Index"
import Login from "./pages/Login/Index";
function App() {

  return (
    <>
      <Router>
        <Routes>
          <Route path="/" element={<Login />}/>
          <Route path="/signup" element={<Signup />} />
        </Routes>
      </Router>
    </>
  )
}

export default App

Signup page code:

const Signup = () => {
  
  const [form] = Form.useForm();
  const dispatch = useDispatch();

  // signup handler 
  const handleSignup = async (values) => {
    const params = new URLSearchParams(window.location.search);
    console.log("params logged :",params)
    const jwt = params.get('x-gcp-marketplace-token');
    if (!jwt) {
        alert('No JWT token found.');
        return;
    }
    dispatch(signup({...values,jwt}))
    form.resetFields()

  };


  return (
    <>
      {/* Signup form built using Ant Design */}
    </>
  )
}

export default Signup

Tried to get x-gcp-marketplace-token in my Signup page but no success . expected to receive x-gcp-marketplace-token in url params .

1 3 262
3 REPLIES 3

I am struggling with the same.

Hi, 

Thanks for reaching out! It seems the question is about Marketplace Saas Integration but the tag being used is for "Application Integration", which is a different product (https://cloud.google.com/application-integration). If this is the case, kindly suggest to use the correct tag for faster routing.

Thanks,

Haitao

thanks for replying , will do it . Can you tell me which tag to use ?

Top Labels in this Space