Next.js Discord

Discord Forum

For Server side rendering to fetch query string

Unanswered
kabhi_Frooti_kabhi_phuchka posted this in #help-forum
Open in Discord
I'm trying to sso in my application from another application so lets take that my application is app A and the app ssoing in my app is app B, so im trying to hit a URL with a query string from app B to app A and im trying to read the query string values in app A using server side rendering but my code is not displaying the values of useparams. In the snippet shared im not able to fetch the searchParams text from URL

3 Replies

do u mean something like this?

export async function GET(request: Request) {
  // Parse query string parameters
  const { searchParams } = new URL(request.url)
  const secret = searchParams.get('secret')
  const slug = searchParams.get('slug')
 
https://<your-site>/api/xxx?secret=<token>&slug=<path>
yeeah got it