<@U0RQY0KK5>, I want to call external api before t...
# prisma-whats-new
p
@nilan, I want to call external api before the save in model In the api call response i will get one token i want to add this token in data and save this token with create data I know we have Function for this which point (TRANSFORM _ARGUMENT, PRE_WRITE) i should call api ????
n
@ppatidar what's your use case for the external API call? is it "expensive"?
p
If some one call User Create mutation then i want to call one api before the save in this api i will send email and password in api response i will get auth token this token i need to save with data
n
awesome! this is a great use case for
TRANSFORM_ARGUMENT
p
Ok Thanks I will try this
n
how is the field called for the token?
p
auth0UserId in User Model
n
are you using the Auth0 auth provider?
p
Yes But I want to call simple mutation at the time of some one call api after the get token then i need to save with Auth0 provider
It its possible my case?
n
the mechanism you want to use should work in general, but not for
createUser
in combination with auth providers
can I ask why you need to do this on the server side?
You can use Auth0 Lock on your client for example that generates a valid token
p
In client side Admin can login with Auth0
after login admin can create other user
at the time of createion we get new session and Admin will logout
This issue we are facing
n
at the time of createion we get new session and Admin will logout
what do you mean with this?
p
Admin create new user after login After user create auth0 provide new session at the client side and admin sesstion will replace with new created user means admin will logout because his session not more
n
is this what you want to achieve, or is this the behaviour you see at the moment but you don't want it?
p
I'm not getting you
n
do you want the admin session to end after he created a new user?
p
I dont want to end session of admin after create user Admin can create multiple user after login admin don't need to logout session every time of create user
n
ok, understood!
You can use auth0-js instead of Auth0 Lock
p
Do you have solution for this?
n
but you need to use version 7: https://auth0.com/docs/libraries/auth0js/v7
p
Ok Nilan I'm checking this
But Dont mind I can do this server side? on function call
n
no this would need to be done client-side as well
p
I noticed that i cant call mutaion call without auth provider Field 'createUser' argument 'authProvider' of type 'AuthProviderSignupData!' is required but not provided. (line 2, column 3):\n createUser(\n ^
n
yes, you need to get a valid Auth0 id token from either Auth0 Lock or auth0-js version 7
p
Ok Thanks Looking into Js
👍 1