This is the repository of the GPT agenda app for the tutorial Authenticate users in GPT actions: Build a personal agenda assistant.
The result is available on gpt-agenda.fordemo.app.
The project is based on Next.js app router, and consists of two parts:
- A set of REST APIs to manage the agenda items (src/app/api/).
- A web app that allows users to monitor agenda items (src/app/page.tsx).
The OpenAPI specification of the REST APIs is available at swagger.yaml. It is used for the GPT action definition.
The REST APIs parse the Authorization
header to get the access token and leverage the Userinfo endpoint to validate the token. See getUserById for details.
This project uses pnpm as the package manager.
Install dependencies:
pnpm i
Start the dev server:
pnpm dev
To run the REST APIs, you need to set the following environment variable:
LOGTO_ENDPOINT
: The endpoint of your Logto tenant. It can be found in the application details page of Logto Console.
To run the web app, besides the above environment variable, you also need to set the following environment variables:
LOGTO_APP_ID
: The ID of the Logto application.LOGTO_APP_SECRET
: The secret of the Logto application.LOGTO_COOKIE_SECRET
: The secret used to sign the cookie.BASE_URL
: The base URL of the web app. It is used to generate the callback URL for OAuth.
Note
The web app should use a separate Logto application from the GPT actions.