@logto/express -- withLogto and access token for api resources #3942
Replies: 2 comments
-
Looking at the audit logs, this is shown:
The resource used should be correct so not sure why it's saying it's unknown. |
Beta Was this translation helpful? Give feedback.
-
This has been responded to in issue #4630 |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm new to Logto and I followed the documentation the best I could. I've successfully been able to use @logto/express and sign in. However, I'm trying to get an access token for my api resource.
I've used this:
app.get( "/fetch-access-token", logToExpress.withLogto({ ...logtoConfig, // Fetch access token from remote, this may slow down the response time, // you can also add "resource" if needed. getAccessToken: true, resources: ["https://api.example.com"], }), (request, response) => { // Get access token here console.log(request.user.accessToken); response.json(request.user); }
I changed resource to resources because it seems like it doesn't work with resource and says I'm unauthenticated.
I'm probably doing something wrong, but maybe something isn't working. How can I successfully get an api resource access token?
Beta Was this translation helpful? Give feedback.
All reactions