Replies: 1 comment 8 replies
-
| Are you sure you are using  const jose = require('jose');
const secret = new TextEncoder().encode("example secret");
const state = { foo: 'bar' }
const jwt = await new jose.SignJWT(state)
  .setProtectedHeader({ alg: 'HS256' })
  .setIssuedAt()
  .setExpirationTime('3h')
  .sign(secret)
console.log(jwt)eyJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJpYXQiOjE3MTM0NDUxNTIsImV4cCI6MTcxMzQ1NTk1Mn0.pPK_19kY10vdA1FsZYnYRz35NCnwVRMJehV9KV6tMWUThis works as expected. | 
Beta Was this translation helpful? Give feedback.
                  
                    8 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hello there,
While trying to use the SignJWT to sign a payload i got the error "error payload must be an instance of Uint8Array".
Anyone know what could it be?
The code:
Beta Was this translation helpful? Give feedback.
All reactions