Compare commits
1 Commits
AUT-794
...
gmail-inte
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b594a8e0f3 |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 21 KiB |
@@ -1,16 +0,0 @@
|
|||||||
const setBaseUrl = ($, requestConfig) => {
|
|
||||||
const realtimeDatabaseId = $.auth.data.realtimeDatabaseId;
|
|
||||||
|
|
||||||
if (requestConfig.additionalProperties?.skipAddingAuthHeader)
|
|
||||||
return requestConfig;
|
|
||||||
|
|
||||||
if (requestConfig.additionalProperties?.setFirestoreBaseUrl) {
|
|
||||||
requestConfig.baseURL = 'https://firestore.googleapis.com';
|
|
||||||
} else {
|
|
||||||
requestConfig.baseURL = `https://${realtimeDatabaseId}.firebaseio.com`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return requestConfig;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default setBaseUrl;
|
|
@@ -1,17 +0,0 @@
|
|||||||
import defineApp from '../../helpers/define-app.js';
|
|
||||||
import addAuthHeader from './common/add-auth-header.js';
|
|
||||||
import auth from './auth/index.js';
|
|
||||||
import setBaseUrl from './common/set-base-url.js';
|
|
||||||
|
|
||||||
export default defineApp({
|
|
||||||
name: 'Firebase',
|
|
||||||
key: 'firebase',
|
|
||||||
baseUrl: 'https://firebase.google.com',
|
|
||||||
apiBaseUrl: '',
|
|
||||||
iconUrl: '{BASE_URL}/apps/firebase/assets/favicon.svg',
|
|
||||||
authDocUrl: 'https://automatisch.io/docs/apps/firebase/connection',
|
|
||||||
primaryColor: 'FFA000',
|
|
||||||
supportsConnections: true,
|
|
||||||
beforeRequest: [setBaseUrl, addAuthHeader],
|
|
||||||
auth,
|
|
||||||
});
|
|
11
packages/backend/src/apps/gmail/assets/favicon.svg
Normal file
11
packages/backend/src/apps/gmail/assets/favicon.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 49.4 512 399.42">
|
||||||
|
<g fill="none" fill-rule="evenodd">
|
||||||
|
<g fill-rule="nonzero">
|
||||||
|
<path fill="#4285f4" d="M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z"/>
|
||||||
|
<path fill="#34a853" d="M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z"/>
|
||||||
|
<path fill="#fbbc04" d="M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z"/>
|
||||||
|
</g>
|
||||||
|
<path fill="#ea4335" d="M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z"/>
|
||||||
|
<path fill="#c5221f" fill-rule="nonzero" d="M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 720 B |
@@ -11,7 +11,7 @@ export default {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
required: true,
|
required: true,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
value: '{WEB_APP_URL}/app/firebase/connections/add',
|
value: '{WEB_APP_URL}/app/gmail/connections/add',
|
||||||
placeholder: null,
|
placeholder: null,
|
||||||
description:
|
description:
|
||||||
'When asked to input a redirect URL in Google Cloud, enter the URL above.',
|
'When asked to input a redirect URL in Google Cloud, enter the URL above.',
|
||||||
@@ -39,29 +39,6 @@ export default {
|
|||||||
description: null,
|
description: null,
|
||||||
clickToCopy: false,
|
clickToCopy: false,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'projectId',
|
|
||||||
label: 'Project ID',
|
|
||||||
type: 'string',
|
|
||||||
required: true,
|
|
||||||
readOnly: false,
|
|
||||||
value: null,
|
|
||||||
placeholder: null,
|
|
||||||
description: 'The project id of your Firebase project',
|
|
||||||
clickToCopy: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'realtimeDatabaseId',
|
|
||||||
label: 'Realtime Database Domain',
|
|
||||||
type: 'string',
|
|
||||||
required: false,
|
|
||||||
readOnly: false,
|
|
||||||
value: null,
|
|
||||||
placeholder: null,
|
|
||||||
description:
|
|
||||||
'If you want to use Realtime Database, please provide the domain of your Realtime Database (https://{{domain}}.firebaseio.com)',
|
|
||||||
clickToCopy: false,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
|
|
||||||
generateAuthUrl,
|
generateAuthUrl,
|
@@ -12,12 +12,7 @@ const refreshToken = async ($) => {
|
|||||||
|
|
||||||
const { data } = await $.http.post(
|
const { data } = await $.http.post(
|
||||||
'https://oauth2.googleapis.com/token',
|
'https://oauth2.googleapis.com/token',
|
||||||
params.toString(),
|
params.toString()
|
||||||
{
|
|
||||||
additionalProperties: {
|
|
||||||
skipAddingAuthHeader: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
@@ -5,21 +5,13 @@ const verifyCredentials = async ($) => {
|
|||||||
(field) => field.key == 'oAuthRedirectUrl'
|
(field) => field.key == 'oAuthRedirectUrl'
|
||||||
);
|
);
|
||||||
const redirectUri = oauthRedirectUrlField.value;
|
const redirectUri = oauthRedirectUrlField.value;
|
||||||
const { data } = await $.http.post(
|
const { data } = await $.http.post(`https://oauth2.googleapis.com/token`, {
|
||||||
`https://oauth2.googleapis.com/token`,
|
|
||||||
{
|
|
||||||
client_id: $.auth.data.clientId,
|
client_id: $.auth.data.clientId,
|
||||||
client_secret: $.auth.data.clientSecret,
|
client_secret: $.auth.data.clientSecret,
|
||||||
code: $.auth.data.code,
|
code: $.auth.data.code,
|
||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
redirect_uri: redirectUri,
|
redirect_uri: redirectUri,
|
||||||
},
|
});
|
||||||
{
|
|
||||||
additionalProperties: {
|
|
||||||
skipAddingAuthHeader: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
await $.auth.set({
|
await $.auth.set({
|
||||||
accessToken: data.access_token,
|
accessToken: data.access_token,
|
@@ -1,7 +1,6 @@
|
|||||||
const authScope = [
|
const authScope = [
|
||||||
'https://www.googleapis.com/auth/datastore',
|
'https://www.googleapis.com/auth/gmail.compose',
|
||||||
'https://www.googleapis.com/auth/firebase.database',
|
'https://www.googleapis.com/auth/gmail.modify',
|
||||||
'https://www.googleapis.com/auth/datastore',
|
|
||||||
'https://www.googleapis.com/auth/userinfo.email',
|
'https://www.googleapis.com/auth/userinfo.email',
|
||||||
'https://www.googleapis.com/auth/userinfo.profile',
|
'https://www.googleapis.com/auth/userinfo.profile',
|
||||||
];
|
];
|
@@ -1,11 +1,6 @@
|
|||||||
const getCurrentUser = async ($) => {
|
const getCurrentUser = async ($) => {
|
||||||
const { data: currentUser } = await $.http.get(
|
const { data: currentUser } = await $.http.get(
|
||||||
'https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses',
|
'https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses'
|
||||||
{
|
|
||||||
additionalProperties: {
|
|
||||||
skipAddingAuthHeader: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
return currentUser;
|
return currentUser;
|
||||||
};
|
};
|
15
packages/backend/src/apps/gmail/index.js
Normal file
15
packages/backend/src/apps/gmail/index.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import defineApp from '../../helpers/define-app.js';
|
||||||
|
import addAuthHeader from './common/add-auth-header.js';
|
||||||
|
import auth from './auth/index.js';
|
||||||
|
export default defineApp({
|
||||||
|
name: 'Gmail',
|
||||||
|
key: 'gmail',
|
||||||
|
baseUrl: 'https://mail.google.com',
|
||||||
|
apiBaseUrl: 'https://gmail.googleapis.com',
|
||||||
|
iconUrl: '{BASE_URL}/apps/gmail/assets/favicon.svg',
|
||||||
|
authDocUrl: 'https://automatisch.io/docs/apps/gmail/connection',
|
||||||
|
primaryColor: 'ea4335',
|
||||||
|
supportsConnections: true,
|
||||||
|
beforeRequest: [addAuthHeader],
|
||||||
|
auth,
|
||||||
|
});
|
@@ -95,12 +95,6 @@ export default defineConfig({
|
|||||||
{ text: 'Connection', link: '/apps/filter/connection' },
|
{ text: 'Connection', link: '/apps/filter/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
text: 'Firebase',
|
|
||||||
collapsible: true,
|
|
||||||
collapsed: true,
|
|
||||||
items: [{ text: 'Connection', link: '/apps/firebase/connection' }],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
text: 'Flickr',
|
text: 'Flickr',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
@@ -147,6 +141,12 @@ export default defineConfig({
|
|||||||
{ text: 'Connection', link: '/apps/gitlab/connection' },
|
{ text: 'Connection', link: '/apps/gitlab/connection' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: 'Gmail',
|
||||||
|
collapsible: true,
|
||||||
|
collapsed: true,
|
||||||
|
items: [{ text: 'Connection', link: '/apps/gmail/connection' }],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: 'Google Calendar',
|
text: 'Google Calendar',
|
||||||
collapsible: true,
|
collapsible: true,
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
# Firebase
|
# Gmail
|
||||||
|
|
||||||
:::info
|
:::info
|
||||||
This page explains the steps you need to follow to set up the Firebase
|
This page explains the steps you need to follow to set up the Gmail
|
||||||
connection in Automatisch. If any of the steps are outdated, please let us know!
|
connection in Automatisch. If any of the steps are outdated, please let us know!
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@@ -9,9 +9,9 @@ connection in Automatisch. If any of the steps are outdated, please let us know!
|
|||||||
2. Click on the project drop-down menu at the top of the page, and click on the **New Project** button.
|
2. Click on the project drop-down menu at the top of the page, and click on the **New Project** button.
|
||||||
3. Enter a name for your project and click on the **Create** button.
|
3. Enter a name for your project and click on the **Create** button.
|
||||||
4. Go to [API Library](https://console.cloud.google.com/apis/library) in Google Cloud console.
|
4. Go to [API Library](https://console.cloud.google.com/apis/library) in Google Cloud console.
|
||||||
5. Search for **Cloud Firestore API** in the search bar and click on it.
|
5. Search for **People API** in the search bar and click on it.
|
||||||
6. Click on the **Enable** button to enable the API.
|
6. Click on the **Enable** button to enable the API.
|
||||||
7. Repeat steps 5 and 6 for the **Firebase Realtime Database API and People API**
|
7. Repeat steps 5 and 6 for the **Gmail API**
|
||||||
8. Go to [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent) in Google Cloud console.
|
8. Go to [OAuth consent screen](https://console.cloud.google.com/apis/credentials/consent) in Google Cloud console.
|
||||||
9. Select **External** here for starting your app in testing mode at first. Click on the **Create** button.
|
9. Select **External** here for starting your app in testing mode at first. Click on the **Create** button.
|
||||||
10. Fill **App Name**, **User Support Email**, and **Developer Contact Information**. Click on the **Save and Continue** button.
|
10. Fill **App Name**, **User Support Email**, and **Developer Contact Information**. Click on the **Save and Continue** button.
|
||||||
@@ -24,8 +24,5 @@ connection in Automatisch. If any of the steps are outdated, please let us know!
|
|||||||
17. Copy **OAuth Redirect URL** from Automatisch to **Authorized redirect URIs** field, and click on the **Create** button.
|
17. Copy **OAuth Redirect URL** from Automatisch to **Authorized redirect URIs** field, and click on the **Create** button.
|
||||||
18. Copy the **Your Client ID** value from the following popup to the `Client ID` field on Automatisch.
|
18. Copy the **Your Client ID** value from the following popup to the `Client ID` field on Automatisch.
|
||||||
19. Copy the **Your Client Secret** value from the following popup to the `Client Secret` field on Automatisch.
|
19. Copy the **Your Client Secret** value from the following popup to the `Client Secret` field on Automatisch.
|
||||||
20. Login to your [Firebase account](https://firebase.google.com/) and go to your project (please create a new project if you don't already have one).
|
20. Click **Submit** button on Automatisch.
|
||||||
21. Click on the gear icon next to **Project Overview** and go to **Project settings**.
|
21. Congrats! Start using your new Gmail connection within the flows.
|
||||||
22. Copy the **Project ID** value to the `Project ID` field on Automatisch.
|
|
||||||
23. Click **Submit** button on Automatisch.
|
|
||||||
24. Congrats! Start using your new Firebase connection within the flows.
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 21 KiB |
11
packages/docs/pages/public/favicons/gmail.svg
Normal file
11
packages/docs/pages/public/favicons/gmail.svg
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 49.4 512 399.42">
|
||||||
|
<g fill="none" fill-rule="evenodd">
|
||||||
|
<g fill-rule="nonzero">
|
||||||
|
<path fill="#4285f4" d="M34.91 448.818h81.454V251L0 163.727V413.91c0 19.287 15.622 34.91 34.91 34.91z"/>
|
||||||
|
<path fill="#34a853" d="M395.636 448.818h81.455c19.287 0 34.909-15.622 34.909-34.909V163.727L395.636 251z"/>
|
||||||
|
<path fill="#fbbc04" d="M395.636 99.727V251L512 163.727v-46.545c0-43.142-49.25-67.782-83.782-41.891z"/>
|
||||||
|
</g>
|
||||||
|
<path fill="#ea4335" d="M116.364 251V99.727L256 204.455 395.636 99.727V251L256 355.727z"/>
|
||||||
|
<path fill="#c5221f" fill-rule="nonzero" d="M0 117.182v46.545L116.364 251V99.727L83.782 75.291C49.25 49.4 0 74.04 0 117.18z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 720 B |
Reference in New Issue
Block a user