Skip to content

Conversation

aliakseitokarev
Copy link
Contributor

@aliakseitokarev aliakseitokarev commented Aug 10, 2025

Add custom policy next-server-api-token.
Add user login endpoint with token

Without token
image

Without token
image
image
image

@aliakseitokarev aliakseitokarev changed the title Feat/add login api Feat: add login api Aug 10, 2025
@aliakseitokarev aliakseitokarev changed the title Feat: add login api feat: add login api Aug 10, 2025
TRANSFER_TOKEN_SALT=tobemodified
JWT_SECRET=tobemodified
ENCRYPTION_KEY=tobemodified
NEXT_SERVER_API_TOKEN=ebab379d647f6afd984a390254830a120f5592a6052337abac544b2239a774e17a24144f04e09b8986e39bf34523b1bf4cc639003de6f551f07a088abfaf617dd62195f0cc95e04909ea714d62848b93aeb94daa555613e2e13084a11e71c21453d7cadecdb1a7a7fd50400762fc2c479277d2bfcfde36dbaac6fb18f38342bf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not look like example

}
try {
const user: BaseUser & {created: boolean} = await loginService.loginUser({ githubId, email });
return ctx.send(user, user.created ? 201 : 200);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be more readable if you first calculate the status code, and then just pass it to send it like

const statusCode = user.created ? CREATED : OK;

return ctx.send(user, statusCode);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants