FIX: oauth creating connection

This commit is contained in:
Gabriel Rosa
2022-09-08 13:34:51 -03:00
parent 77db6f3771
commit 8c6ec8b1b9
4 changed files with 9 additions and 6 deletions
+2 -1
View File
@@ -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',
+1
View File
@@ -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
View File
File diff suppressed because one or more lines are too long