# Auth0 Resource Owner Password Flow with JWT Tokens Error

**URL:** <https://community.auth0.com/t/auth0-resource-owner-password-flow-with-jwt-tokens-error/120224>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [November 4, 2023, 7:06am UTC](https://community.auth0.com/t/auth0-resource-owner-password-flow-with-jwt-tokens-error/120224 "2023-11-04T07:06:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cameron\_codes](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/cameron_codes/32/52217_2.png) [@cameron\_codes](https://community.auth0.com/u/cameron_codes)\
**Post date:** [November 4, 2023, 7:06am UTC](https://community.auth0.com/t/auth0-resource-owner-password-flow-with-jwt-tokens-error/120224/1 "2023-11-04T07:06:49Z")

</div>

Hi all,

I am working on a project that implements the Resource Owner Password flow from Auth0 with Express, however, I am running into an error.

Here’s the code:

```js
import express, {Request, Response, Express} from "express";
import {auth} from "express-oauth2-jwt-bearer";

require("dotenv").config();

const PORT = process.env.PORT || 8080;

const checkJwt = auth({
    issuer: process.env.AUTH0_ISSUER_BASE_URL,
    audience: process.env.AUTH0_AUDIENCE_URL,
    secret: process.env.SECRET,
    tokenSigningAlg: "HS256"
  });  

const app: Express = express(),
    port = PORT;

app.use(checkJwt);

app.get("/", (req: Request, res: Response) => {
    const auth = req.auth;
    console.log(auth.payload)
    res.json({"status": "Authenticated"});
});

app.listen(port, () => {
    console.log("Server listening on port " + port);
});

```

After I obtain an access token from Auth0, I try to use it with my own API but receive the following error:

```auto
InvalidTokenError: KeyObject or CryptoKey instances for asymmetric algorithms must not be of type "secret"

```

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [November 9, 2023, 3:18pm UTC](https://community.auth0.com/t/auth0-resource-owner-password-flow-with-jwt-tokens-error/120224/3 "2023-11-09T15:18:17Z")

</div>

Hi @cameron_codes,

Welcome to the Auth0 Community!

If you inspect the token (you can do so at [jwt.io](http://jwt.io)), what signing algorithm does it use? You should see it in the token header as the `alg` claim.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 28, 2023, 3:19pm UTC](https://community.auth0.com/t/auth0-resource-owner-password-flow-with-jwt-tokens-error/120224/4 "2023-11-28T15:19:58Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
