Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

249
Views
How to send JWT token as query param in NEXT js?
const Jwt = (props) => {
  const { jwt } = props;
  const [jwtToken, setJwtToken] = useState(null);

  useEffect(() => {
    if (jwt) {
      setAuthToken(jwt);
      setJwtToken(jwt);
    }
  }, [jwt]);

  return <MobilePurchaseScreen {...props} />;
};

export const getServerSideProps = async (context) => {
  const { query } = context;
  const { jwt } = query;
  return {
    props: {
      jwt,
    },
  };
};

export default Jwt;

I am using next js where I have sending JWT token as path directly, How can I send it as query param.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I dont think it is safe to send jwt as query param unless it is one time use only. Because If someone grabs it can use it. To get jwt as query you have to set it first:

  <Link href=`/post/abc?jwt=${jwtTokenHere}`>
      <a>Visit the post/abc/jwt=</a>
    </Link>

Then when you visit that page, in getServerSideProps:

export async function getServerSideProps(context) {
  const { jwt } = context.query;

  console.log(`jwt: ${jwt}`);
  return { props: { jwt } };
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!