MCPcopy Create free account
hub / github.com/coderwhy/coderhub / login

Method login

src/controller/auth.controller.js:5–13  ·  view source on GitHub ↗
(ctx, next)

Source from the content-addressed store, hash-verified

3
4class AuthController {
5 async login(ctx, next) {
6 const { id, name } = ctx.user;
7 const token = jwt.sign({ id, name }, PRIVATE_KEY, {
8 expiresIn: 60 * 60 * 24,
9 algorithm: 'RS256'
10 });
11
12 ctx.body = { id, name, token }
13 }
14
15 async success(ctx, next) {
16 ctx.body = "授权成功~";

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected