is there any way to send a token without session-b...
# general
e
is there any way to send a token without session-based management. like, if i just want to verify a clientID and secret instead?
r
Yes. There is.
Which backend SDK will you be using?
e
NodeJS + Hapi
i was able to set it up with the Session and verifySession from the recipe, but i guess it doesn't work in this use-case.
r
So you can use the JWT only recipe to issue JWTs as you like
e
ah, i didn't see that recipe on the site.
do you have a link?
r
Yea. it's not mentioned explicitly on the site cause it comes under machine to machine and that's not fully done yet. So we didn't add this. But what you want to do is something like:
Copy code
import { createJWT } from "supertokens-node/recipe/jwt";

createJWT(
    { someKey: "someValue" }, // JWT payload
).then(result => {
    if (result.status === "OK") {
        let jwt = result.jwt;
        // your logic with the JWT
    } else {
        throw Error("Should never come here");
    }
})
WOuld this work for you?
e
it might! do you have a link to the where the implementation for the JWT-only recipe is on GitHub?
e
awesome! i'll look into this and get back to you? thanks for the help so far,
r
Sure! Feel free to ask further questions on this server.
e
@User i'm getting this error:
Copy code
UnhandledPromiseRejectionWarning: Error: SuperTokens core threw an error for a POST request to path: '/recipe/jwt' with status code: 400 and message: Field name 'validity' is invalid in JSON input
r
Hmm. Can you please open an issue about this on our GitHub?
n
@User could you also post the code where you are getting this error?