feat: 飞书登录修改public路由
This commit is contained in:
parent
49a38f7bce
commit
7d5e734e39
|
|
@ -1,18 +1,21 @@
|
||||||
import { Controller, Get, Query, Res } from '@nestjs/common';
|
import { Controller, Get, Query, Res } from '@nestjs/common';
|
||||||
import { LarkService } from './lark.service';
|
import { LarkService } from './lark.service';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
|
import { Public } from '../auth/decorators/public.decorator';
|
||||||
|
|
||||||
@Controller('lark')
|
@Controller('lark')
|
||||||
export class LarkController {
|
export class LarkController {
|
||||||
constructor(private readonly larkService: LarkService) { }
|
constructor(private readonly larkService: LarkService) { }
|
||||||
|
|
||||||
@Get('login')
|
@Get('login')
|
||||||
|
@Public()
|
||||||
async login(@Query('redirectUri') redirectUri: string, @Res() res: Response) {
|
async login(@Query('redirectUri') redirectUri: string, @Res() res: Response) {
|
||||||
const loginUrl = await this.larkService.getLoginUrl(redirectUri);
|
const loginUrl = await this.larkService.getLoginUrl(redirectUri);
|
||||||
return res.redirect(loginUrl);
|
return res.redirect(loginUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('callback')
|
@Get('callback')
|
||||||
|
@Public()
|
||||||
async callback(@Query('code') code: string, @Res() res: Response) {
|
async callback(@Query('code') code: string, @Res() res: Response) {
|
||||||
if (!code) {
|
if (!code) {
|
||||||
return res.status(400).send('Authorization code is missing');
|
return res.status(400).send('Authorization code is missing');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue