Hi please here me here how to setup the supertoken...
# support-questions-legacy
s
Hi please here me here how to setup the supertokens. I am using nest I have 2 microservice: M1 and M2 as API gateway. I have setup the supertokens in M1. it takes cred from M2 and signIn. and return Jwt tokens. In M2(no st) when i verify this token in M2 it gives : { "message": "Invalid token", "error": "Unauthorized", "statusCode": 401 }
r
hey @satty_71243 what token are you sending m2? And how are you verifying that token in m2?
s
i am creating the jwt token with payload of userId in M1 and sending it to M2 and varifying it in M2 using the method provided for microservices.
this is the method i am using to verify the jwt token.
r
right. What does the jwks endpoint return if you go to that in your browser? Also, how are you creating the jwt?
any error stack from the jwt verification lib?
s
using this method to create the jwt.
u mean this endpoint in browser: http://localhost:4001/auth/jwt/jwks.json ?
r
Yes
s
this endpoint kept loading in the browser.
r
Hmm. Then something is wrong
Is your backend on localhost:4001? If you apiBasePath /auth?
s
this M1 is on localhost:4001 & M2 is on localhost:4000
r
Can you enable backend debug logs for supertokens backend SDK and show the output when you call the jwks endpoint?
s
not getting anything.
r
That’s means that api request is not hitting your backend.
s
what could be the cause ? since my M2 is exposed to endpoints sends the "signing" event and M1 takes the events and using signin method from email and password recipe.
plese help here
r
im really not sure what you have setup here.
Sorry, will be difficult to help without detailed context.
the sign in is meant for users and not for machine to machine auth
s
let me know this flow if this is possible ? flow is like this, - user enters the credentials to M2 (no st init), - then M2 pass his cred to M1 (st init) and and it - authenticate the creds and generate jwt token as response. - then using this token in M2 for others endpoints.
r
yea, this is possible
so what part in that step is causing issues?
s
after generating the token when verifying in the M2 it shows the un authorised
r
how are you trying to verify the token?
i need a stack trace for the error from the jwt verfication lib
s
also dashboard is not accessible . using localhost:4001
r
it';s on localhost:4001/auth/dashboard
and make sure you have followed all the steps mentioned in our docs
would be great if you keep your questions specific.
s
let me know if this is causing issue , M2 is communicating with m1 using TCP
r
Otherwise it will be hard to help out for free like this
s
sorry i am using this localhost:4001/auth/dashboard to access this but stuck on the loading
r
please providde console logs, network screenshot, backend error stack if any, version of the backend sdk, framework being used.
what all you have already tried to see in our docs
the supertokens.init config on the backend
also, please checkout our demo app and see how thats setup .
s
no i have setup all this from the docs. it is working fine when i remove microservice setup from M1 and login from endpoint auth/signin and generate token and verifying this in M2. in this approach M1 is exposed.
i understand in my case st is not initialised since i cannot see any logs when i making a request to M2 since i have setup the st in M1.
atlease help me here what could be the setup to achive this flow ?
2 Views