Hey guys — I’m trying to pass some additional data...
# ask-a-descoper
g
Hey guys — I’m trying to pass some additional data that can be used later in the login flow. Right now, I’m using the
client
property on the Descope component in the Next.js SDK for this. Is this the right approach for passing custom variables through the flow? Also, what’s the correct way to access this data inside the flow?
✅ 1
b
Yeah, you can use the client prop on the Descope component for passing data. Pass data in the component:
Copy code
<Descope
  flowId="my-flow-id"
  client={{ version: "1.2.0", planTier: "pro" }}
/>
g
@Bhagwanta Yeole Following your example, how would I be able to retrieve this
version
and
planTier
variables on the login flow?
Hey @Meir Wahnon sorry to bother. Any change I can get some eyes from the Descope staff about the question I made? This is something I need to figure it so the login flow works as expected on my app.
m
@Akash Jivane @Bhagwanta Yeole can you follow up here
🙌 1
b
@Gabriel Where do you want to use this variable excatly in the flow or screens?
g
@Bhagwanta Yeole I want do get the variable and use it in a connector at some point of the login flow.
Still following the example you gave, I tried using
{{client.planTier}}
to get the variable in the flow, but it didn't work.
b
Okay, let me check.
r
Hi @Gabriel The reason
{{client.planTier}}
isn't working is that the
client
prop is intended for browser/environment metadata (like browser name/version) and isn't available as a dynamic key inside flows or connectors. To pass custom data like
planTier
and
version
into a connector, you should use the
form
prop
instead:
Copy code
<Descope
  flowId="your-flow-id"
  form={{
    'planTier': 'pro',
    'version': '1.2.0'
  }}
/>
Then in your connector inside the flow, reference it as:
{{form.planTier}}
and
{{form.version}}
The
form
inputs are fully accessible in flow actions, connectors, and conditionals. Doc: https://docs.descope.com/flows/dynamic-keys/flow-inputs
g
Let me try with the form prop! Thanks @Rahul Rijhwani
🙌 1
@Rahul Rijhwani Is there a way to replicate this passing of custom data to the form prop on the Descope flow editor?
I'm trying to pass a variable called "clientId" in the forms props, but apparently it is not working. I'm not being able to get the data in the login flow.
Can I send the exported flow here for you to check if I'm doing anything wrong?
r
Yes please share flow json here
g
resident-login-copy.json
Also, it seems that all the variables I'm setting here on the configure option, when running the flow on the Descope dashboard, is not being set at all
And, when trying to run the flow on a next.js app, using the descope sdk for next.js, I get this on the dev console after putting an email address and clicking "continue":
Constructive criticism: these error logs are too generic and we, as devs, should be able to see, and place, console.logs when running a login flow with the sdk
Not sure if this is possible currently, but I was only able to put and see console.logs of certain steps of the flow when running the flow on the Descope dashboard
Example of a generic error I'm getting here after removing all the actions on my flow that could potentially be trying to access a variable before its initialization:
r
Looked through the flow JSON, found two issues: 1. ScriptletFailure — TDZ bug in "Get user email" (Task 18) The crash at
1:67
is caused by this line in your scriptlet:
Copy code
const userEmail = formEmail || unauthUserEmail || userEmail
You're re-declaring
userEmail
with
const
while also referencing it on the right side. JavaScript's
const
creates a Temporal Dead Zone, so
|| userEmail
hits the TDZ of the new variable instead of the scriptArg — causing the
ReferenceError
. Fix it by renaming the const:
Copy code
const resolvedEmail = formEmail || unauthUserEmail || userEmail
return { userEmail: resolvedEmail };
2.
env
scriptArg is mapped to wrong context key
Your
env
arg is mapped to context
"env"
which doesn't exist as a Descope dynamic key — it's always
undefined
. Change it to
form.env
in the scriptlet args. Then pass it from your app:
Copy code
<Descope form={{ clientId: 1004, env: 'production' }} />
And in the dashboard configure panel, set
env
→
descopeDashboard
to test that branch. The
form.clientId
value itself IS flowing through correctly — the scriptlet crash was just preventing it from being used.
g
Let's check here. Thanks again!
I fixed the Scriptlet TDZ but I'm still getting a "Unexpected error occurred. Please try again later"
👀 1
r
Did you do above change in flows can you send me your updated flows
g
b
Hey @Gabriel , Can you please try to add curly braces to the variable you want to use from the form or client prop? Attaching the screenshot for your reference.
I can see in your flow you are not adding.
Copy code
{{form.variable_name}}
g
I tried adding the curly braces before, and now after your suggestion, and it didn't work :(
Any other ideas on how to fix this guys? @Rahul Rijhwani @Bhagwanta Yeole
r
Let me check with internal team CC @Nick Rodriguez
g
I was able to fix this issue!
form.clientId seems to be a reserved field
r
Great, Let us know if any other help needed.
g
I tried with form.customerId and it worked on both the descope dashboard and inside my next.js app
Not sure if you guys were aware of that, but it would be nice to have this info in the docs in case someone else runs into this issue!
Thanks for the help, guys!
r
Sounds good now it is working Thanks for highlight, We will add this point in to document