Skip to content

Commit

Permalink
Merge branch 'master' into kelvinwari/ext-525-add-support-from-lemlist
Browse files Browse the repository at this point in the history
  • Loading branch information
hassan254-prog authored Feb 28, 2025
2 parents cb9e509 + 95a3f7f commit 241a5e0
Show file tree
Hide file tree
Showing 21 changed files with 257 additions and 99 deletions.
4 changes: 2 additions & 2 deletions docs-v2/integrations/all/amazon-selling-partner-beta.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ _No setup guide yet._

## Useful links

- [Amazon Selling Partner Authentication docs](https://developer-docs.amazon.com/amazon-shipping/docs/authorizing-selling-partner-api-applications#constructing-an-oauth-authorization-uri)
- [Amazon Selling Partner API docs](https://developer-docs.amazon.com/amazon-shipping/docs/shipping-api-v2-reference)
- [Amazon Selling Partner Authentication docs](https://developer-docs.amazon.com/amazon-shipping/docs/amazon-scpn-authorization-workflow)
- [Amazon Selling Partner API docs](https://developer-docs.amazon.com/sp-api/reference/welcome-to-api-references)

<Note>Contribute useful links by [editing this page](https://github.com/nangohq/nango/tree/master/docs-v2/integrations/all/amazon-selling-partner-beta.mdx)</Note>

Expand Down
4 changes: 2 additions & 2 deletions docs-v2/integrations/all/amazon-selling-partner.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ _No setup guide yet._

## Useful links

- [Amazon Selling Partner Authentication docs](https://developer-docs.amazon.com/amazon-shipping/docs/authorizing-selling-partner-api-applications#constructing-an-oauth-authorization-uri)
- [Amazon Selling Partner API docs](https://developer-docs.amazon.com/amazon-shipping/docs/shipping-api-v2-reference)
- [Amazon Selling Partner Authentication docs](https://developer-docs.amazon.com/amazon-shipping/docs/amazon-scpn-authorization-workflow)
- [Amazon Selling Partner API docs](https://developer-docs.amazon.com/sp-api/reference/welcome-to-api-references)

<Note>Contribute useful links by [editing this page](https://github.com/nangohq/nango/tree/master/docs-v2/integrations/all/amazon-selling-partner.mdx)</Note>

Expand Down
7 changes: 7 additions & 0 deletions docs-v2/snippets/generated/google-mail/PreBuiltUseCases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
</Accordion>


<Accordion title="Labels">
| Endpoint | Description | Readme |
| - | - | - |
| `GET /labels` | Fetches a list of labels from gmail. | [🔗](https://github.com/NangoHQ/integration-templates/blob/main/integrations/google-mail/syncs/labels.md) |
</Accordion>


<Accordion title="Others">
| Endpoint | Description | Readme |
| - | - | - |
Expand Down
1 change: 1 addition & 0 deletions docs-v2/snippets/generated/outlook/PreBuiltUseCases.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| - | - | - |
| `GET /fetch-attachment` | An action used to fetch the contents of an attachment. | [🔗](https://github.com/NangoHQ/integration-templates/blob/main/integrations/outlook/actions/fetch-attachment.md) |
| `GET /emails` | Fetches a list of emails from outlook. Goes back default to 1 year<br />but metadata can be set using the `backfillPeriodMs` property<br />to change the lookback. The property should be set in milliseconds. | [🔗](https://github.com/NangoHQ/integration-templates/blob/main/integrations/outlook/syncs/emails.md) |
| `GET /folders` | Fetches a list of folders from outlook. | [🔗](https://github.com/NangoHQ/integration-templates/blob/main/integrations/outlook/syncs/folders.md) |
</Accordion>

</AccordionGroup>
Expand Down
2 changes: 2 additions & 0 deletions packages/jobs/lib/execution/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ export async function handleSyncSuccess({ nangoProps }: { nangoProps: NangoProps
connection: connection,
environment: environment,
syncConfig: nangoProps.syncConfig,
syncVariant: nangoProps.syncVariant || 'base',
providerConfig,
webhookSettings,
model,
Expand Down Expand Up @@ -697,6 +698,7 @@ async function onFailure({
account: team,
providerConfig,
syncConfig,
syncVariant,
connection: connection,
environment: environment,
webhookSettings,
Expand Down
2 changes: 2 additions & 0 deletions packages/jobs/lib/execution/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export async function handleWebhookSuccess({ nangoProps }: { nangoProps: NangoPr
environment: environment,
webhookSettings,
syncConfig: nangoProps.syncConfig,
syncVariant: nangoProps.syncVariant || 'base',
providerConfig,
model,
now: nangoProps.startedAt,
Expand Down Expand Up @@ -367,6 +368,7 @@ async function onFailure({
connection: connection,
webhookSettings,
syncConfig,
syncVariant,
providerConfig,
model: models.join(','),
success: false,
Expand Down
10 changes: 9 additions & 1 deletion packages/providers/providers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ amazon-selling-partner:
auth_mode: OAUTH2
authorization_url: https://${connectionConfig.domain}/apps/authorize/consent
token_url: https://api.amazon.com/auth/o2/token
authorization_code_param_in_callback: spapi_oauth_code
disable_pkce: true
authorization_params:
application_id: ${connectionConfig.applicationId}
token_params:
Expand All @@ -356,6 +358,8 @@ amazon-selling-partner:
grant_type: refresh_token
proxy:
base_url: https://sellingpartnerapi-${connectionConfig.region}.amazon.com
headers:
x-amz-access-token: ${accessToken}
docs: https://docs.nango.dev/integrations/all/amazon-selling-partner
docs_connect: https://docs.nango.dev/integrations/all/amazon-selling-partner/connect
connection_config:
Expand Down Expand Up @@ -392,6 +396,8 @@ amazon-selling-partner-beta:
auth_mode: OAUTH2
authorization_url: https://${connectionConfig.domain}/apps/authorize/consent
token_url: https://api.amazon.com/auth/o2/token
authorization_code_param_in_callback: spapi_oauth_code
disable_pkce: true
authorization_params:
application_id: ${connectionConfig.applicationId}
version: beta
Expand All @@ -400,7 +406,9 @@ amazon-selling-partner-beta:
refresh_params:
grant_type: refresh_token
proxy:
base_url: https://sellingpartnerapi-${connectionConfig.region}.amazon.com
base_url: https://sandbox.sellingpartnerapi-${connectionConfig.region}.amazon.com
headers:
x-amz-access-token: ${accessToken}
docs: https://docs.nango.dev/integrations/all/amazon-selling-partner-beta
docs_connect: https://docs.nango.dev/integrations/all/amazon-selling-partner-beta/connect
connection_config:
Expand Down
14 changes: 8 additions & 6 deletions packages/server/lib/controllers/oauth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,15 +907,17 @@ class OAuthController {
account: DBTeam,
logCtx: LogContext
) {
const { code } = req.query;
const authCodeParam = provider.authorization_code_param_in_callback || 'code';
const authorizationCode = req.query[authCodeParam] as string | undefined;

const providerConfigKey = session.providerConfigKey;
const connectionId = session.connectionId;
const channel = session.webSocketClientId;
const callbackMetadata = getConnectionMetadataFromCallbackRequest(req.query, provider);

const installationId = req.query['installation_id'] as string | undefined;

if (!code) {
if (!authorizationCode) {
const error = WSErrBuilder.InvalidCallbackOAuth2();
await logCtx.error(error.message, {
scopes: config.oauth_scopes,
Expand Down Expand Up @@ -1010,7 +1012,7 @@ class OAuthController {
providerConfigKey,
connectionId,
additionalTokenParams,
code,
authorizationCode,
scopes: config.oauth_scopes,
basicAuthEnabled: provider.token_request_auth_method === 'basic',
tokenParams: provider.token_params
Expand All @@ -1019,11 +1021,11 @@ class OAuthController {
const tokenUrl = typeof provider.token_url === 'string' ? provider.token_url : (provider.token_url?.['OAUTH2'] as string);

if (providerClientManager.shouldUseProviderClient(session.provider)) {
rawCredentials = await providerClientManager.getToken(config, tokenUrl, code as string, session.callbackUrl, session.codeVerifier);
rawCredentials = await providerClientManager.getToken(config, tokenUrl, authorizationCode, session.callbackUrl, session.codeVerifier);
} else {
const accessToken = await simpleOAuthClient.getToken(
{
code: code as string,
code: authorizationCode,
redirect_uri: session.callbackUrl,
...additionalTokenParams
},
Expand Down Expand Up @@ -1193,7 +1195,7 @@ class OAuthController {
`OAuth connection successful${provider.auth_mode === 'CUSTOM' && !installationId ? ' and request for app approval is pending' : ''}`,
{
additionalTokenParams,
code,
authorizationCode,
scopes: config.oauth_scopes,
basicAuthEnabled: provider.token_request_auth_method === 'basic',
tokenParams: provider.token_params
Expand Down
Loading

0 comments on commit 241a5e0

Please # to comment.