mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-19 05:39:07 +00:00
FIX: oauth creating connection
This commit is contained in:
@@ -4,6 +4,7 @@ import { AuthGuard } from '@nestjs/passport';
|
||||
import { ConnectionClientService } from '../connection/client.service';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import DadosferaLogger from '@dadosfera/dadosfera-logs/dist';
|
||||
import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
|
||||
@ApiTags('oauth')
|
||||
@Controller('oauth')
|
||||
export class OauthController {
|
||||
@@ -157,7 +158,7 @@ export class OauthController {
|
||||
try {
|
||||
const response = await this.connectionService.createConnection(
|
||||
connectionInfo,
|
||||
{ customer_id, customer_name, user_id },
|
||||
PackTheMetadata({ customer_id, customer_name, user_id }),
|
||||
);
|
||||
this.redirectUrl.searchParams.set(
|
||||
'connection_id',
|
||||
|
||||
@@ -43,6 +43,7 @@ export class OauthService {
|
||||
customer_name,
|
||||
type,
|
||||
properties,
|
||||
plugin,
|
||||
};
|
||||
return jwt.sign({ ...newConnection }, process.env.JWT_PRIVATE_KEY);
|
||||
}
|
||||
|
||||
@@ -30,10 +30,11 @@ export class MailChimpStrategy extends PassportStrategy(Strategy, 'mailchimp') {
|
||||
}
|
||||
|
||||
authenticate(@Req() req, options) {
|
||||
options.state = this.oauthService.generateStateFromRequest(
|
||||
req,
|
||||
'application',
|
||||
);
|
||||
if (!req.route.path.includes('callback'))
|
||||
options.state = this.oauthService.generateStateFromRequest(
|
||||
req,
|
||||
'application',
|
||||
);
|
||||
super.authenticate(req, options);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user