mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 20:00:02 +00:00
Zoho node
This commit is contained in:
@@ -913,7 +913,7 @@ class App {
|
||||
|
||||
// Verify and store app code. Generate access tokens and store for respective credential.
|
||||
this.app.get('/rest/oauth2-credential/callback', async (req: express.Request, res: express.Response) => {
|
||||
const {code, state: stateEncoded} = req.query;
|
||||
const {code, state: stateEncoded } = req.query;
|
||||
|
||||
if (code === undefined || stateEncoded === undefined) {
|
||||
throw new Error('Insufficient parameters for OAuth2 callback');
|
||||
@@ -953,6 +953,20 @@ class App {
|
||||
return ResponseHelper.sendErrorResponse(res, errorResponse);
|
||||
}
|
||||
|
||||
let options = {};
|
||||
|
||||
// Here we need a variable that can be set on the credentials
|
||||
// so that base on that include the credentails on the body or
|
||||
// leave it as default with woukd include the credentails on the header.
|
||||
// if (thatvariableistrue) {
|
||||
// options = {
|
||||
// body: {
|
||||
// client_id: _.get(oauthCredentials, 'clientId') as string,
|
||||
// client_secret: _.get(oauthCredentials, 'clientSecret', '') as string,
|
||||
// },
|
||||
// }
|
||||
// }
|
||||
|
||||
const oAuthObj = new clientOAuth2({
|
||||
clientId: _.get(oauthCredentials, 'clientId') as string,
|
||||
clientSecret: _.get(oauthCredentials, 'clientSecret', '') as string,
|
||||
@@ -962,7 +976,7 @@ class App {
|
||||
scopes: _.split(_.get(oauthCredentials, 'scope', 'openid,') as string, ',')
|
||||
});
|
||||
|
||||
const oauthToken = await oAuthObj.code.getToken(req.originalUrl);
|
||||
const oauthToken = await oAuthObj.code.getToken(req.originalUrl, options);
|
||||
|
||||
if (oauthToken === undefined) {
|
||||
const errorResponse = new ResponseHelper.ResponseError('Unable to get access tokens!', undefined, 404);
|
||||
|
||||
Reference in New Issue
Block a user