mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Fix CLI Auth docs (#556)
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Emulator Test / docker (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Preview Docs / run (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Some checks failed
all-good: Did all the other checks pass? / all-good (push) Has been cancelled
Ensure Prisma migrations are in sync with the schema / check_prisma_migrations (22.x) (push) Has been cancelled
Docker Emulator Test / docker (push) Has been cancelled
Docker Server Build and Push / Docker Build and Push Server (push) Has been cancelled
Docker Server Test / docker (push) Has been cancelled
Runs E2E API Tests / build (22.x) (push) Has been cancelled
Lint & build / lint_and_build (latest) (push) Has been cancelled
Preview Docs / run (push) Has been cancelled
Dev Environment Test / restart-dev-and-test (push) Has been cancelled
Run setup tests / setup-tests (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
This commit is contained in:
parent
392a3f9790
commit
f4dc6826d1
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,6 +14,7 @@ node-compile-cache/
|
||||
.eslintcache
|
||||
.env.local
|
||||
.env.*.local
|
||||
scratch/
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
|
||||
@ -25,9 +25,8 @@ export const POST = createSmartRouteHandler({
|
||||
}),
|
||||
async handler({ auth: { tenancy }, body: { login_code, refresh_token } }) {
|
||||
// Find the CLI auth attempt
|
||||
const cliAuth = await prismaClient.cliAuthAttempt.findFirst({
|
||||
const cliAuth = await prismaClient.cliAuthAttempt.findUnique({
|
||||
where: {
|
||||
tenancyId: tenancy.id,
|
||||
loginCode: login_code,
|
||||
refreshToken: null,
|
||||
expiresAt: {
|
||||
@ -40,6 +39,10 @@ export const POST = createSmartRouteHandler({
|
||||
throw new StatusError(400, "Invalid login code or the code has expired");
|
||||
}
|
||||
|
||||
if (cliAuth.tenancyId !== tenancy.id) {
|
||||
throw new StatusError(400, "Project ID mismatch; please ensure that you are using the correct app url.");
|
||||
}
|
||||
|
||||
// Update with refresh token
|
||||
await prismaClient.cliAuthAttempt.update({
|
||||
where: {
|
||||
|
||||
@ -5,7 +5,7 @@ description: How to authenticate a command line application using Stack Auth
|
||||
|
||||
If you're building a command line application that runs in a terminal, you can use Stack Auth to let your users log in to their accounts.
|
||||
|
||||
To do so, we provide a Python template that you can use as a starting point. [Download it here](https://app.stack-auth.com/stack_auth_cli_template.py) and copy it into your project, for example:
|
||||
To do so, we provide a Python template that you can use as a starting point. [Download it here](https://github.com/stack-auth/stack-auth/docs/examples/stack_auth_cli_template.py) and copy it into your project, for example:
|
||||
|
||||
```py
|
||||
└─ my-python-app
|
||||
|
||||
Loading…
Reference in New Issue
Block a user