emailengine-app 2.82.2 → 2.83.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ncurc.js +8 -1
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +29 -0
- package/data/google-crawlers.json +1 -1
- package/lib/account.js +16 -3
- package/lib/api-reference/format.js +1 -1
- package/lib/api-routes/account-routes.js +8 -6
- package/lib/api-routes/blocklist-routes.js +4 -4
- package/lib/api-routes/export-routes.js +5 -5
- package/lib/api-routes/oauth2-app-routes.js +8 -2
- package/lib/api-routes/route-helpers.js +34 -0
- package/lib/api-routes/submit-routes.js +6 -5
- package/lib/bounce-detect.js +4 -2
- package/lib/egress-filter.js +8 -3
- package/lib/email-client/gmail-client.js +3 -1
- package/lib/email-client/imap-client.js +2 -1
- package/lib/email-client/outlook-client.js +11 -2
- package/lib/enum-descriptions.js +3 -1
- package/lib/imapproxy/imap-core/README.md +1 -0
- package/lib/imapproxy/imap-core/lib/commands/authenticate-plain.js +11 -1
- package/lib/imapproxy/proxy-handoff.js +6 -3
- package/lib/imapproxy/response-error.js +14 -1
- package/lib/oauth/gcp-metadata.js +259 -0
- package/lib/oauth/gmail.js +121 -20
- package/lib/oauth/mail-ru.js +10 -4
- package/lib/oauth/outlook.js +11 -4
- package/lib/oauth/token-fetch.js +4 -2
- package/lib/oauth/verify-app.js +126 -32
- package/lib/oauth2-apps.js +67 -13
- package/lib/schemas.js +60 -18
- package/lib/swagger-options.js +2 -3
- package/lib/tools.js +52 -2
- package/lib/ui-routes/admin-entities-routes.js +2 -2
- package/lib/ui-routes/auth-routes.js +4 -1
- package/lib/ui-routes/gmail-service-auth.js +64 -0
- package/lib/ui-routes/oauth-config-routes.js +22 -31
- package/lib/ui-routes/oauth-form-context.js +19 -0
- package/lib/ui-routes/suppression-list-routes.js +2 -2
- package/lib/utils/network.js +29 -0
- package/lib/webhook-request.js +12 -4
- package/lib/webhook-routing.js +34 -11
- package/package.json +11 -11
- package/sbom.json +1 -1
- package/server.js +8 -2
- package/static/css/flyonui.css +1 -1
- package/static/js/app.js +2 -1
- package/static/js/ui.js +6 -1
- package/static/licenses.html +18 -28
- package/translations/messages.pot +73 -73
- package/views/accounts/account.hbs +0 -5
- package/views/accounts/edit.hbs +1 -1
- package/views/config/imap-proxy.hbs +1 -1
- package/views/config/network.hbs +7 -5
- package/views/config/oauth/app.hbs +2 -0
- package/views/config/oauth/edit.hbs +0 -10
- package/views/config/oauth/new.hbs +0 -10
- package/views/config/smtp.hbs +1 -1
- package/views/config/tls.hbs +2 -2
- package/views/config/webhooks.hbs +1 -1
- package/views/partials/oauth_form.hbs +493 -906
- package/views/partials/oauth_graph_endpoints.hbs +12 -0
- package/views/partials/oauth_pubsub_app_select.hbs +11 -20
- package/views/partials/oauth_scope_presets.hbs +21 -0
- package/views/partials/ui/choice-tab.hbs +23 -0
- package/views/partials/ui/choice-tabs.hbs +32 -0
- package/views/partials/ui/radio.hbs +2 -2
- package/views/partials/ui/secret-field.hbs +2 -1
- package/views/partials/ui/tabs.hbs +1 -2
- package/workers/api.js +4 -2
- package/workers/webhooks.js +18 -7
|
@@ -1,191 +1,321 @@
|
|
|
1
|
-
{{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
mailbox owner must complete an interactive OAuth2 login. Use this when users manage their own
|
|
5
|
-
accounts or when you have access to the mailbox credentials.
|
|
6
|
-
{{#if providerData.tutorialUrl}}
|
|
7
|
-
Read about setting up {{providerData.comment}} OAuth2 project from <a href="{{providerData.tutorialUrl}}"
|
|
8
|
-
target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer" class="link link-animated">here</a>.
|
|
9
|
-
{{/if}}
|
|
10
|
-
{{/ui/stat-card}}
|
|
11
|
-
{{/if}}
|
|
1
|
+
{{!-- The OAuth2 application form, shared by the new and edit pages for every provider. Top to bottom it
|
|
2
|
+
asks what the app is (Application), what it connects with (Base scope, which decides which fields and
|
|
3
|
+
sections apply), how it signs in (Credentials) and, optionally, which scopes to add or drop. --}}
|
|
12
4
|
|
|
13
|
-
{{#if activeGmailService}}
|
|
14
5
|
{{#> ui/stat-card variant="info" icon="icon-[tabler--info-circle]" class="mb-6"}}
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</
|
|
6
|
+
<div class="space-y-2">
|
|
7
|
+
<p>
|
|
8
|
+
{{#if activeGmail}}
|
|
9
|
+
Users sign in with their own Google account, through the hosted authentication form or your own OAuth2 flow.
|
|
10
|
+
Create an OAuth client of the <em>Web application</em> type in the Google Cloud console and add the redirect
|
|
11
|
+
URL below to it.
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{#if activeGmailService}}
|
|
14
|
+
<strong>Service accounts</strong> let EmailEngine reach Google without an interactive user login. An
|
|
15
|
+
<strong>IMAP and SMTP</strong> or <strong>Gmail API</strong> app accesses any mailbox in your Google
|
|
16
|
+
Workspace organization through domain-wide delegation, which must be enabled for the service account in
|
|
17
|
+
Workspace. A <strong>Cloud Pub/Sub</strong> app accesses no mailboxes: it sets up the real-time change
|
|
18
|
+
notifications your Gmail API apps use.
|
|
19
|
+
{{/if}}
|
|
20
|
+
{{#if activeOutlook}}
|
|
21
|
+
<strong>Delegated</strong> access: EmailEngine acts on behalf of a signed-in user, so each mailbox owner
|
|
22
|
+
completes an interactive OAuth2 login. Use it when users connect their own accounts.
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{#if activeOutlookService}}
|
|
25
|
+
<strong>Application</strong> access: EmailEngine authenticates as the app itself with client credentials,
|
|
26
|
+
and no user signs in. The Entra app registration needs <strong>application</strong> permissions (not
|
|
27
|
+
delegated) with admin consent. Use it for service integrations and shared mailboxes.
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#if activeMailRu}}
|
|
30
|
+
Users sign in with their own Mail.ru account, through the hosted authentication form or your own OAuth2
|
|
31
|
+
flow.
|
|
32
|
+
{{/if}}
|
|
33
|
+
</p>
|
|
34
|
+
{{#if providerData.serviceAccount}}
|
|
35
|
+
<p>Accounts of this app can only be added through the <a href="/admin/reference/account#postV1Account"
|
|
36
|
+
class="link link-animated">REST API</a>, not the hosted authentication form.</p>
|
|
37
|
+
{{/if}}
|
|
38
|
+
{{#if providerData.tutorialUrl}}
|
|
39
|
+
<p><a href="{{providerData.tutorialUrl}}" target="_blank" rel="noopener noreferrer" referrerpolicy="no-referrer"
|
|
40
|
+
class="link link-animated">Read the {{providerData.comment}} setup guide</a></p>
|
|
41
|
+
{{/if}}
|
|
42
|
+
</div>
|
|
31
43
|
{{/ui/stat-card}}
|
|
32
|
-
{{/if}}
|
|
33
44
|
|
|
34
|
-
{{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
not through the hosted authentication form.
|
|
43
|
-
{{#if providerData.tutorialUrl}}
|
|
44
|
-
Read about setting up {{providerData.comment}} from <a href="{{providerData.tutorialUrl}}" target="_blank"
|
|
45
|
-
rel="noopener noreferrer" referrerpolicy="no-referrer" class="link link-animated">here</a>.
|
|
46
|
-
{{/if}}
|
|
47
|
-
{{/ui/stat-card}}
|
|
48
|
-
{{/if}}
|
|
45
|
+
{{#> ui/card title="Application" bodyClass="space-y-4"}}
|
|
46
|
+
<div>
|
|
47
|
+
{{#> ui/form-field id="name" label="Application name" error=errors.name}}
|
|
48
|
+
<input type="text" class="input{{#if errors.name}} is-invalid{{/if}}" id="name" name="name" value="{{values.name}}"
|
|
49
|
+
placeholder="For example "My App"" required />
|
|
50
|
+
<span class="helper-text">Shown in the OAuth2 app list.</span>
|
|
51
|
+
{{/ui/form-field}}
|
|
52
|
+
</div>
|
|
49
53
|
|
|
50
|
-
<div
|
|
54
|
+
<div>
|
|
55
|
+
{{#> ui/form-field id="description" label="Description" error=errors.description}}
|
|
56
|
+
<input type="text" class="input{{#if errors.description}} is-invalid{{/if}}" id="description" name="description"
|
|
57
|
+
value="{{values.description}}" />
|
|
58
|
+
<span class="helper-text">Optional. A note on what this app is used for.</span>
|
|
59
|
+
{{/ui/form-field}}
|
|
60
|
+
</div>
|
|
51
61
|
|
|
52
|
-
|
|
62
|
+
{{#unless providerData.serviceAccount}}
|
|
63
|
+
<div>
|
|
64
|
+
{{#> ui/form-field id="title" label="Display title" error=errors.title}}
|
|
65
|
+
<input type="text" class="input{{#if errors.title}} is-invalid{{/if}}" id="title" name="title"
|
|
66
|
+
value="{{values.title}}" />
|
|
67
|
+
<span class="helper-text">Optional. Shown on this app's button in the hosted authentication form.</span>
|
|
68
|
+
{{/ui/form-field}}
|
|
69
|
+
</div>
|
|
53
70
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{{/ui/form-field}}
|
|
60
|
-
</div>
|
|
71
|
+
<div>
|
|
72
|
+
{{> ui/checkbox id="enabled" name="enabled" label="Enable this app" checked=values.enabled error=errors.enabled
|
|
73
|
+
hint="Offer this app as an account type in the hosted authentication form."}}
|
|
74
|
+
</div>
|
|
75
|
+
{{/unless}}
|
|
61
76
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
77
|
+
{{#if activeGmail}}
|
|
78
|
+
<div>
|
|
79
|
+
{{> ui/checkbox id="googleWorkspaceAccounts" name="googleWorkspaceAccounts"
|
|
80
|
+
label="Accept only Google Workspace accounts" checked=values.googleWorkspaceAccounts
|
|
81
|
+
error=errors.googleWorkspaceAccounts
|
|
82
|
+
hint="Shows only Google Workspace accounts on the Gmail sign-in screen, and refuses the setup if a personal account signs in anyway."}}
|
|
83
|
+
</div>
|
|
84
|
+
{{/if}}
|
|
85
|
+
{{/ui/card}}
|
|
86
|
+
|
|
87
|
+
{{!-- The base scope comes before the credentials: it decides which sections apply (the Pub/Sub app
|
|
88
|
+
selector, the scope presets, the Graph notification endpoints) and, for a service account, which
|
|
89
|
+
authentication methods can be offered (the attached service account is Pub/Sub only). One panel per
|
|
90
|
+
scope, each marked data-base-scopes; checkScopesRadio() shows the selected one. A stored app's scope
|
|
91
|
+
cannot change, so its page names the scope instead of offering the strip, and the server renders the
|
|
92
|
+
matching panel visible. Mail.ru has a single mode and no card. --}}
|
|
93
|
+
{{#unless activeMailRu}}
|
|
94
|
+
{{!-- wrap-anywhere: the scope URLs in the descriptions have no break points of their own --}}
|
|
95
|
+
{{#> ui/card title="Base scope" bodyClass="space-y-4 wrap-anywhere"}}
|
|
96
|
+
|
|
97
|
+
{{#if activeOutlookService}}
|
|
98
|
+
<input type="hidden" name="baseScopes" value="api" />
|
|
99
|
+
<p><strong>MS Graph API</strong> <span class="text-sm text-base-content/60">- the only mode application
|
|
100
|
+
access supports</span></p>
|
|
101
|
+
{{else if actionCreate}}
|
|
102
|
+
{{#> ui/choice-tabs label="Base scope" heading="What the app connects with" note="Fixed once the app is created"
|
|
103
|
+
elId="base-scope-tabs"}}
|
|
104
|
+
{{> ui/choice-tab id="baseScopesImap" name="baseScopes" value="imap" label="IMAP and SMTP"
|
|
105
|
+
checked=baseScopesImap class="base-scopes-radio"}}
|
|
106
|
+
{{> ui/choice-tab id="baseScopesAPI" name="baseScopes" value="api"
|
|
107
|
+
label=(when activeOutlook "MS Graph API" "Gmail API") checked=baseScopesApi class="base-scopes-radio"}}
|
|
108
|
+
{{#if activeGmailService}}
|
|
109
|
+
{{> ui/choice-tab id="baseScopesPubsub" name="baseScopes" value="pubsub" label="Cloud Pub/Sub"
|
|
110
|
+
checked=baseScopesPubsub class="base-scopes-radio"}}
|
|
111
|
+
{{/if}}
|
|
112
|
+
{{/ui/choice-tabs}}
|
|
113
|
+
{{else}}
|
|
114
|
+
<p>
|
|
115
|
+
<strong>{{#if baseScopesPubsub}}Cloud Pub/Sub{{else if baseScopesApi}}{{#if activeOutlook}}MS Graph API{{else}}Gmail API{{/if}}{{else}}IMAP and SMTP{{/if}}</strong>
|
|
116
|
+
<span class="text-sm text-base-content/60">- fixed once the app is created</span>
|
|
117
|
+
</p>
|
|
118
|
+
{{/if}}
|
|
69
119
|
|
|
70
|
-
{{#unless
|
|
71
|
-
<div>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
120
|
+
{{#unless activeOutlookService}}
|
|
121
|
+
<div class="space-y-4{{#unless baseScopesImap}} hidden{{/unless}}" data-base-scopes="imap">
|
|
122
|
+
<p class="text-sm">
|
|
123
|
+
{{#if activeGmail}}Mail is synced over IMAP and sent over SMTP. Requires the
|
|
124
|
+
<code>https://mail.google.com/</code> scope on the OAuth consent screen.{{/if}}
|
|
125
|
+
{{#if activeGmailService}}Mail is synced over IMAP and sent over SMTP for any mailbox in your
|
|
126
|
+
Workspace. Authorize the domain-wide delegation for <code>https://mail.google.com/</code>.{{/if}}
|
|
127
|
+
{{#if activeOutlook}}Mail is synced over IMAP and sent over SMTP. Requires the
|
|
128
|
+
<code>IMAP.AccessAsUser.All</code> and <code>SMTP.Send</code> delegated permissions.{{/if}}
|
|
129
|
+
</p>
|
|
77
130
|
</div>
|
|
78
|
-
{{/unless}}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
131
|
+
{{/unless}}
|
|
132
|
+
|
|
133
|
+
<div class="space-y-4{{#unless activeOutlookService}}{{#unless baseScopesApi}} hidden{{/unless}}{{/unless}}"
|
|
134
|
+
data-base-scopes="api">
|
|
135
|
+
<p class="text-sm">
|
|
136
|
+
{{#if activeGmail}}Mail is synced and sent through the Gmail HTTP API. Requires the
|
|
137
|
+
<code>https://www.googleapis.com/auth/gmail.modify</code> scope on the OAuth consent screen.{{/if}}
|
|
138
|
+
{{#if activeGmailService}}Mail is synced and sent through the Gmail HTTP API for any mailbox in
|
|
139
|
+
your Workspace. Authorize the domain-wide delegation for
|
|
140
|
+
<code>https://www.googleapis.com/auth/gmail.modify</code>.{{/if}}
|
|
141
|
+
{{#if activeOutlook}}Mail is synced and sent through Microsoft Graph. Requires the
|
|
142
|
+
<code>Mail.ReadWrite</code> and <code>Mail.Send</code> delegated permissions.{{/if}}
|
|
143
|
+
{{#if activeOutlookService}}Mail is synced and sent through Microsoft Graph. Requires the
|
|
144
|
+
<code>Mail.ReadWrite</code>, <code>Mail.Send</code> and <code>User.Read.All</code> application
|
|
145
|
+
permissions with admin consent.{{/if}}
|
|
146
|
+
</p>
|
|
147
|
+
{{!-- Guarded on providerData.gmailApi, not on one provider: a service account in Gmail API mode
|
|
148
|
+
takes the same delegated scopes an interactive app takes, so the presets apply to it too --}}
|
|
149
|
+
{{#if providerData.gmailApi}}
|
|
150
|
+
{{> oauth_scope_presets provider="gmail"}}
|
|
151
|
+
{{> oauth_pubsub_app_select}}
|
|
152
|
+
{{/if}}
|
|
153
|
+
{{#if activeOutlook}}
|
|
154
|
+
{{> oauth_scope_presets provider="outlook"}}
|
|
155
|
+
{{> oauth_graph_endpoints}}
|
|
156
|
+
{{/if}}
|
|
157
|
+
{{#if activeOutlookService}}
|
|
158
|
+
{{> oauth_graph_endpoints}}
|
|
159
|
+
{{/if}}
|
|
87
160
|
</div>
|
|
88
|
-
{{/if}}
|
|
89
161
|
|
|
90
|
-
{{#
|
|
91
|
-
<div>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
162
|
+
{{#if activeGmailService}}
|
|
163
|
+
<div class="space-y-4{{#unless baseScopesPubsub}} hidden{{/unless}}" data-base-scopes="pubsub">
|
|
164
|
+
<p class="text-sm">Accesses no mailboxes: creates and manages the Pub/Sub topic and subscription that
|
|
165
|
+
deliver real-time change notifications for your Gmail API apps. The service account needs the
|
|
166
|
+
<code>Pub/Sub Admin</code> role in the project.</p>
|
|
167
|
+
{{#if actionCreate}}
|
|
168
|
+
<div>
|
|
169
|
+
{{#> ui/form-field id="googleTopicName" label="Topic name" error=errors.googleTopicName}}
|
|
170
|
+
<input type="text" class="input{{#if errors.googleTopicName}} is-invalid{{/if}}" id="googleTopicName"
|
|
171
|
+
name="googleTopicName" value="{{values.googleTopicName}}" placeholder="ee-pub-<app id>" />
|
|
172
|
+
<span class="helper-text">Optional. Leave empty to use the generated name shown.</span>
|
|
173
|
+
{{/ui/form-field}}
|
|
174
|
+
</div>
|
|
175
|
+
<div>
|
|
176
|
+
{{#> ui/form-field id="googleSubscriptionName" label="Subscription name"
|
|
177
|
+
error=errors.googleSubscriptionName}}
|
|
178
|
+
<input type="text" class="input{{#if errors.googleSubscriptionName}} is-invalid{{/if}}"
|
|
179
|
+
id="googleSubscriptionName" name="googleSubscriptionName"
|
|
180
|
+
value="{{values.googleSubscriptionName}}" placeholder="ee-sub-<app id>" />
|
|
181
|
+
<span class="helper-text">Optional. Leave empty to use the generated name shown.</span>
|
|
182
|
+
{{/ui/form-field}}
|
|
183
|
+
</div>
|
|
184
|
+
{{else}}
|
|
185
|
+
<dl class="ee-dl">
|
|
186
|
+
<dt>Pub/Sub topic</dt>
|
|
187
|
+
<dd>{{#if appData.pubSubTopic}}<code>{{lastVal appData.pubSubTopic "/"}}</code>{{else}}Not created
|
|
188
|
+
yet{{/if}}</dd>
|
|
189
|
+
<dt>Pub/Sub subscription</dt>
|
|
190
|
+
<dd>{{#if appData.pubSubSubscription}}<code>{{lastVal appData.pubSubSubscription
|
|
191
|
+
"/"}}</code>{{else}}Not created yet{{/if}}</dd>
|
|
192
|
+
</dl>
|
|
193
|
+
{{/if}}
|
|
95
194
|
</div>
|
|
96
|
-
{{/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
</div>
|
|
195
|
+
{{/if}}
|
|
196
|
+
{{/ui/card}}
|
|
197
|
+
{{/unless}}
|
|
100
198
|
|
|
199
|
+
{{!-- Hand-rolled rather than ui/card: the whole body is one {{#if}}/{{else}}, which is the shape that
|
|
200
|
+
loses its content inside a partial block (see .claude/rules/admin-ui.md) --}}
|
|
101
201
|
<div class="card bg-base-100 shadow-md mb-6">
|
|
102
202
|
|
|
103
203
|
<div class="card-header">
|
|
104
|
-
<h6 class="card-title text-primary">
|
|
204
|
+
<h6 class="card-title text-primary">Credentials</h6>
|
|
105
205
|
</div>
|
|
106
206
|
|
|
107
207
|
<div class="card-body space-y-4">
|
|
108
208
|
|
|
109
209
|
{{#if activeGmailService}}
|
|
110
210
|
|
|
211
|
+
{{#if authMethodLocked}}
|
|
111
212
|
<div>
|
|
112
|
-
<
|
|
213
|
+
<span class="label-text block">Authentication method</span>
|
|
113
214
|
<input type="hidden" name="authMethod" id="authMethod"
|
|
114
|
-
value="{{#if authMethodIsExternalAccount}}externalAccount{{else}}serviceKey{{/if}}" />
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
215
|
+
value="{{#if authMethodIsExternalAccount}}externalAccount{{else if authMethodIsMetadataServer}}metadataServer{{else}}serviceKey{{/if}}" />
|
|
216
|
+
<p>
|
|
217
|
+
<strong>{{#if authMethodIsExternalAccount}}Workload Identity Federation{{else if
|
|
218
|
+
authMethodIsMetadataServer}}Attached service account{{else}}Service account key{{/if}}</strong>
|
|
219
|
+
<span class="text-sm text-base-content/60">- fixed once the app is created</span>
|
|
119
220
|
</p>
|
|
120
|
-
<span class="helper-text">The authentication method is fixed once the application has been created and
|
|
121
|
-
cannot be changed.</span>
|
|
122
|
-
{{else}}
|
|
123
|
-
{{!-- custom tab behavior: the script at the end of this partial
|
|
124
|
-
toggles tab-active and the auth-method sections; not a FlyonUI
|
|
125
|
-
data-tabs instance, deliberately - each method toggles two
|
|
126
|
-
.auth-method-section blocks that are interleaved with fields
|
|
127
|
-
shared by both methods, and HSTabs maps one toggle to exactly
|
|
128
|
-
one content element. The script also syncs the hidden
|
|
129
|
-
#authMethod input submitted with the form. --}}
|
|
130
|
-
<nav class="tabs tabs-bordered" id="auth-method-tabs" role="tablist" aria-label="Authentication method">
|
|
131
|
-
<button type="button" class="tab auth-method-tab{{#if authMethodIsServiceKey}} tab-active{{/if}}"
|
|
132
|
-
id="auth-method-tab-serviceKey" data-auth-method="serviceKey" role="tab"
|
|
133
|
-
aria-selected="{{#if authMethodIsServiceKey}}true{{else}}false{{/if}}">Service account key</button>
|
|
134
|
-
<button type="button" class="tab auth-method-tab{{#if authMethodIsExternalAccount}} tab-active{{/if}}"
|
|
135
|
-
id="auth-method-tab-externalAccount" data-auth-method="externalAccount" role="tab"
|
|
136
|
-
aria-selected="{{#if authMethodIsExternalAccount}}true{{else}}false{{/if}}">Workload Identity
|
|
137
|
-
Federation (keyless)</button>
|
|
138
|
-
</nav>
|
|
139
|
-
<span class="helper-text">"Service account key" expects a downloaded JSON key file.
|
|
140
|
-
"Workload Identity Federation" authenticates without a long-lived key, using a credential issued
|
|
141
|
-
by your runtime environment.</span>
|
|
142
|
-
{{/if}}
|
|
143
221
|
</div>
|
|
222
|
+
{{else}}
|
|
223
|
+
{{!-- A ui/choice-tabs strip: the selection is the submitted authMethod radio. Every method is
|
|
224
|
+
always offered, so the strip never changes shape. The attached service account is Pub/Sub
|
|
225
|
+
only (the metadata server's token is the service account's own and cannot impersonate a
|
|
226
|
+
Workspace user): outside that base scope its tab carries a badge saying so, and choosing it
|
|
227
|
+
selects the Cloud Pub/Sub base scope above. The script at the end of this partial swaps the
|
|
228
|
+
.auth-method-section blocks, which are interleaved with fields shared by the methods, and
|
|
229
|
+
each method's own description opens its section. --}}
|
|
230
|
+
<div>
|
|
231
|
+
{{#> ui/choice-tabs label="Authentication method" heading="Authentication method"
|
|
232
|
+
note="Fixed once the app is created" elId="auth-method-tabs"}}
|
|
233
|
+
{{> ui/choice-tab id="authMethodServiceKey" name="authMethod" value="serviceKey"
|
|
234
|
+
label="Service account key" checked=authMethodIsServiceKey class="auth-method-radio"}}
|
|
235
|
+
{{> ui/choice-tab id="authMethodExternalAccount" name="authMethod" value="externalAccount"
|
|
236
|
+
label="Workload Identity Federation" checked=authMethodIsExternalAccount class="auth-method-radio"}}
|
|
237
|
+
{{> ui/choice-tab id="authMethodMetadataServer" name="authMethod" value="metadataServer"
|
|
238
|
+
label="Attached service account" checked=authMethodIsMetadataServer class="auth-method-radio"
|
|
239
|
+
badgeLabel="Pub/Sub only" badgeId="authMethodScopeBadge" badgeHidden=baseScopesPubsub}}
|
|
240
|
+
{{/ui/choice-tabs}}
|
|
241
|
+
<span class="helper-text text-warning hidden" id="authMethodNotice" aria-live="polite"></span>
|
|
242
|
+
</div>
|
|
243
|
+
{{/if}}
|
|
144
244
|
|
|
145
|
-
<div class="auth-method-section auth-method-section-serviceKey{{#unless authMethodIsServiceKey}} hidden{{/unless}}">
|
|
245
|
+
<div class="auth-method-section auth-method-section-serviceKey space-y-3{{#unless authMethodIsServiceKey}} hidden{{/unless}}">
|
|
246
|
+
{{#unless authMethodLocked}}
|
|
247
|
+
<p class="text-sm">Signs in with a JSON key file downloaded from the Google Cloud console.</p>
|
|
248
|
+
{{/unless}}
|
|
146
249
|
<div>
|
|
147
|
-
{{> ui/btn label="Load
|
|
250
|
+
{{> ui/btn label="Load from the key file..." variant="info" id="serviceFile"
|
|
148
251
|
icon="icon-[tabler--cloud-upload]"}}
|
|
149
252
|
<span class="helper-text">Choose a service account key JSON file to fill in the credentials below.</span>
|
|
150
253
|
</div>
|
|
151
254
|
</div>
|
|
152
255
|
|
|
153
|
-
<div class="auth-method-section auth-method-section-externalAccount{{#unless authMethodIsExternalAccount}} hidden{{/unless}}">
|
|
256
|
+
<div class="auth-method-section auth-method-section-externalAccount space-y-3{{#unless authMethodIsExternalAccount}} hidden{{/unless}}">
|
|
257
|
+
{{#unless authMethodLocked}}
|
|
258
|
+
<p class="text-sm">No long-lived key: EmailEngine exchanges a credential issued by its runtime (GKE,
|
|
259
|
+
EKS, AKS or any OIDC-emitting workload) for Google access tokens.</p>
|
|
260
|
+
{{/unless}}
|
|
154
261
|
<div>
|
|
155
|
-
{{> ui/btn label="Load
|
|
262
|
+
{{> ui/btn label="Load from the configuration file..." variant="info"
|
|
156
263
|
id="externalAccountFile" icon="icon-[tabler--cloud-upload]"}}
|
|
157
264
|
<span class="helper-text">Select the credential configuration file produced by
|
|
158
265
|
<code>gcloud iam workload-identity-pools create-cred-config</code>.</span>
|
|
159
266
|
</div>
|
|
160
267
|
</div>
|
|
161
268
|
|
|
269
|
+
<div class="auth-method-section auth-method-section-metadataServer{{#unless authMethodIsMetadataServer}} hidden{{/unless}}">
|
|
270
|
+
<div class="space-y-2">
|
|
271
|
+
<p class="text-sm">Uses the service account of the VM, GKE workload or Cloud Run service EmailEngine
|
|
272
|
+
runs on, so there is nothing to store. Available for Cloud Pub/Sub apps only. Grant that service
|
|
273
|
+
account the <code>Pub/Sub Admin</code> role, and on Compute Engine give the VM the
|
|
274
|
+
<code>cloud-platform</code> access scope.</p>
|
|
275
|
+
{{#if actionCreate}}
|
|
276
|
+
<div class="flex flex-wrap items-center gap-3">
|
|
277
|
+
{{> ui/btn label="Detect from this host" variant="info" id="metadataProbe"
|
|
278
|
+
icon="icon-[tabler--cloud-search]"}}
|
|
279
|
+
<span class="helper-text" id="metadataProbeResult" aria-live="polite"></span>
|
|
280
|
+
</div>
|
|
281
|
+
{{/if}}
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
|
|
162
285
|
<div>
|
|
163
|
-
{{#> ui/form-field id="googleProjectId" label="Google Cloud
|
|
286
|
+
{{#> ui/form-field id="googleProjectId" label="Google Cloud project ID" error=errors.googleProjectId}}
|
|
164
287
|
<input type="text" class="input{{#if errors.googleProjectId}} is-invalid{{/if}}" id="googleProjectId"
|
|
165
288
|
name="googleProjectId" value="{{values.googleProjectId}}"
|
|
166
|
-
placeholder="
|
|
289
|
+
placeholder="For example "project-name-425411""
|
|
167
290
|
required />
|
|
168
|
-
<span class="helper-text">
|
|
291
|
+
<span class="helper-text">The project that owns the service account. A Cloud Pub/Sub app creates its
|
|
292
|
+
topic and subscription there.</span>
|
|
169
293
|
{{/ui/form-field}}
|
|
170
294
|
</div>
|
|
171
295
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
296
|
+
{{!-- Not used by the attached service account, which the metadata server identifies. The
|
|
297
|
+
inputs of a hidden auth-method section are disabled, so their required attribute cannot
|
|
298
|
+
block the form and their values are not submitted --}}
|
|
299
|
+
<div
|
|
300
|
+
class="auth-method-section auth-method-section-serviceKey auth-method-section-externalAccount space-y-4{{#if authMethodIsMetadataServer}} hidden{{/if}}">
|
|
301
|
+
<div>
|
|
302
|
+
{{#> ui/form-field id="serviceClientEmail" label="Service account email" error=errors.serviceClientEmail}}
|
|
303
|
+
<input type="email" class="input{{#if errors.serviceClientEmail}} is-invalid{{/if}}" id="serviceClientEmail"
|
|
304
|
+
name="serviceClientEmail" value="{{values.serviceClientEmail}}"
|
|
305
|
+
placeholder="For example "name@project-123.iam.gserviceaccount.com""
|
|
306
|
+
required {{#if authMethodIsMetadataServer}}disabled{{/if}} />
|
|
307
|
+
<span class="helper-text">Email address of the Google service account.</span>
|
|
308
|
+
{{/ui/form-field}}
|
|
309
|
+
</div>
|
|
181
310
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
311
|
+
<div>
|
|
312
|
+
{{#> ui/form-field id="serviceClient" label="Service account client ID" error=errors.serviceClient}}
|
|
313
|
+
<input type="text" class="input{{#if errors.serviceClient}} is-invalid{{/if}}" id="serviceClient"
|
|
314
|
+
name="serviceClient" value="{{values.serviceClient}}" placeholder="For example "104226123456789012345""
|
|
315
|
+
required {{#if authMethodIsMetadataServer}}disabled{{/if}} />
|
|
316
|
+
<span class="helper-text">Numeric client ID used to configure domain-wide delegation.</span>
|
|
317
|
+
{{/ui/form-field}}
|
|
318
|
+
</div>
|
|
189
319
|
</div>
|
|
190
320
|
|
|
191
321
|
<div class="auth-method-section auth-method-section-serviceKey{{#unless authMethodIsServiceKey}} hidden{{/unless}}">
|
|
@@ -219,750 +349,173 @@ Read about setting up {{providerData.comment}} from <a href="{{providerData.tuto
|
|
|
219
349
|
</div>
|
|
220
350
|
</div>
|
|
221
351
|
|
|
222
|
-
{{else
|
|
352
|
+
{{else}}
|
|
223
353
|
|
|
354
|
+
{{#if activeGmail}}
|
|
224
355
|
<div>
|
|
225
|
-
{{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
{{/ui/form-field}}
|
|
356
|
+
{{> ui/btn label="Load from the client JSON file..." variant="info" id="gmailConfigFile"
|
|
357
|
+
icon="icon-[tabler--cloud-upload]"}}
|
|
358
|
+
<span class="helper-text">Fills in the fields below from the client file downloaded from the Google Cloud
|
|
359
|
+
console.</span>
|
|
230
360
|
</div>
|
|
361
|
+
{{/if}}
|
|
231
362
|
|
|
232
363
|
<div>
|
|
233
|
-
{{#> ui/form-field id="
|
|
234
|
-
<input type="text" class="input{{#if errors.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
364
|
+
{{#> ui/form-field id="clientId" label=(when providerData.microsoft "Application (client) ID" "Client ID") error=errors.clientId}}
|
|
365
|
+
<input type="text" class="input{{#if errors.clientId}} is-invalid{{/if}}" id="clientId" name="clientId"
|
|
366
|
+
value="{{values.clientId}}" required />
|
|
367
|
+
<span class="helper-text">
|
|
368
|
+
{{#if activeGmail}}From APIs & Services > Credentials in the Google Cloud console.{{/if}}
|
|
369
|
+
{{#if providerData.microsoft}}From the Overview page of the app registration in Microsoft
|
|
370
|
+
Entra.{{/if}}
|
|
371
|
+
{{#if activeMailRu}}From the settings of your Mail.ru OAuth2 application.{{/if}}
|
|
372
|
+
</span>
|
|
239
373
|
{{/ui/form-field}}
|
|
240
374
|
</div>
|
|
241
375
|
|
|
242
376
|
<div>
|
|
243
|
-
{{#> ui/form-field id="
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
{{/
|
|
252
|
-
</
|
|
253
|
-
<span class="helper-text">Accounts hosted in different cloud environments use different OAuth2
|
|
254
|
-
endpoints.</span>
|
|
377
|
+
{{#> ui/form-field id="clientSecret" label="Client secret" error=errors.clientSecret}}
|
|
378
|
+
{{> ui/secret-field id="clientSecret" value=values.clientSecret toggleId="showClientSecret"
|
|
379
|
+
toggleLabel="Show client secret" error=errors.clientSecret required=(when hasClientSecret "" "required")
|
|
380
|
+
placeholder=(when hasClientSecret "Set, not shown. Leave empty to keep it." "")}}
|
|
381
|
+
<span class="helper-text">
|
|
382
|
+
{{#if activeGmail}}Shown next to the client ID in the Google Cloud console.{{/if}}
|
|
383
|
+
{{#if providerData.microsoft}}The secret's Value from Certificates & secrets, not its Secret
|
|
384
|
+
ID.{{/if}}
|
|
385
|
+
{{#if activeMailRu}}From the settings of your Mail.ru OAuth2 application.{{/if}}
|
|
386
|
+
</span>
|
|
255
387
|
{{/ui/form-field}}
|
|
256
388
|
</div>
|
|
257
389
|
|
|
258
|
-
<div>
|
|
259
|
-
{{#> ui/form-field id="authority" label="Directory (tenant) ID" error=errors.authority}}
|
|
260
|
-
<input type="text" class="input{{#if errors.authority}} is-invalid{{/if}}" id="authority" name="authority"
|
|
261
|
-
value="{{values.authority}}"
|
|
262
|
-
placeholder="Enter tenant ID, eg. "f8cdef31-a31e-4b4a-93e4-5f571e91255a"" required />
|
|
263
|
-
<span class="helper-text">The Directory (tenant) ID from your Entra app registration. Client credentials
|
|
264
|
-
flow requires a specific tenant ID.</span>
|
|
265
|
-
{{/ui/form-field}}
|
|
266
|
-
</div>
|
|
267
|
-
|
|
268
|
-
{{else}}
|
|
269
|
-
|
|
270
390
|
{{#if activeGmail}}
|
|
271
|
-
|
|
272
|
-
<div>
|
|
273
|
-
{{> ui/btn label="Load configuration from the JSON file…" variant="info" id="gmailConfigFile"
|
|
274
|
-
icon="icon-[tabler--cloud-upload]"}}
|
|
275
|
-
<span class="helper-text">Choose the OAuth client JSON file downloaded from Google Cloud Console.</span>
|
|
276
|
-
</div>
|
|
277
|
-
|
|
278
391
|
<div>
|
|
279
|
-
{{#> ui/form-field id="googleProjectId" label="Google Cloud
|
|
392
|
+
{{#> ui/form-field id="googleProjectId" label="Google Cloud project ID" error=errors.googleProjectId}}
|
|
280
393
|
<input type="text" class="input{{#if errors.googleProjectId}} is-invalid{{/if}}" id="googleProjectId"
|
|
281
394
|
name="googleProjectId" value="{{values.googleProjectId}}"
|
|
282
|
-
placeholder="
|
|
283
|
-
<span class="helper-text">
|
|
395
|
+
placeholder="For example "project-name-425411"" />
|
|
396
|
+
<span class="helper-text">Optional. The project that owns the OAuth client; a Gmail API app uses it to
|
|
397
|
+
offer Pub/Sub apps from the same project.</span>
|
|
284
398
|
{{/ui/form-field}}
|
|
285
399
|
</div>
|
|
286
|
-
|
|
287
400
|
{{/if}}
|
|
288
401
|
|
|
289
|
-
|
|
290
|
-
{{#> ui/form-field id="clientId" error=errors.clientId}}
|
|
291
|
-
<label class="label-text" for="clientId">
|
|
292
|
-
{{#if activeGmail}}
|
|
293
|
-
Client ID
|
|
294
|
-
{{/if}}
|
|
295
|
-
|
|
296
|
-
{{#if activeMailRu}}
|
|
297
|
-
Client ID
|
|
298
|
-
{{/if}}
|
|
299
|
-
|
|
300
|
-
{{#if activeOutlook}}
|
|
301
|
-
Application (client) ID
|
|
302
|
-
{{/if}}
|
|
303
|
-
</label>
|
|
304
|
-
<input type="text" class="input{{#if errors.clientId}} is-invalid{{/if}}" id="clientId" name="clientId"
|
|
305
|
-
value="{{values.clientId}}" placeholder="Enter client ID…" required />
|
|
306
|
-
<span class="helper-text">Client ID from your provider's app configuration.</span>
|
|
307
|
-
{{/ui/form-field}}
|
|
308
|
-
</div>
|
|
309
|
-
|
|
310
|
-
<div>
|
|
311
|
-
{{#> ui/form-field id="clientSecret" label="Client Secret" error=errors.clientSecret}}
|
|
312
|
-
<input type="text" class="input{{#if errors.clientSecret}} is-invalid{{/if}}" id="clientSecret"
|
|
313
|
-
name="clientSecret" value="{{values.clientSecret}}" {{#if hasClientSecret}}
|
|
314
|
-
placeholder="Client secret is set but not shown…" {{else}} placeholder="Enter client
|
|
315
|
-
secret…" {{/if}} {{#unless hasClientSecret}}required{{/unless}} />
|
|
316
|
-
<span class="helper-text">OAuth2 client secret.</span>
|
|
317
|
-
{{/ui/form-field}}
|
|
318
|
-
</div>
|
|
319
|
-
|
|
320
|
-
{{#if activeOutlook}}
|
|
321
|
-
|
|
402
|
+
{{#if providerData.microsoft}}
|
|
322
403
|
<div>
|
|
323
404
|
{{#> ui/form-field id="cloud" label="Azure cloud environment" error=errors.cloud}}
|
|
324
|
-
<select class="select max-w-md{{#if errors.cloud}} is-invalid{{/if}}" id="cloud" name="cloud"
|
|
325
|
-
required>
|
|
326
|
-
|
|
405
|
+
<select class="select max-w-md{{#if errors.cloud}} is-invalid{{/if}}" id="cloud" name="cloud" required>
|
|
327
406
|
{{#each azureClouds}}
|
|
328
|
-
<option value="{{id}}" {{#if selected}}selected{{/if}}>{{name}}{{#if
|
|
329
|
-
description}} -
|
|
407
|
+
<option value="{{id}}" {{#if selected}}selected{{/if}}>{{name}}{{#if description}} -
|
|
330
408
|
{{description}}{{/if}}</option>
|
|
331
409
|
{{/each}}
|
|
332
410
|
</select>
|
|
333
|
-
<span class="helper-text">Accounts
|
|
334
|
-
and scopes.</span>
|
|
411
|
+
<span class="helper-text">Accounts in different cloud environments use different OAuth2 endpoints.</span>
|
|
335
412
|
{{/ui/form-field}}
|
|
336
413
|
</div>
|
|
337
|
-
|
|
338
414
|
{{/if}}
|
|
339
415
|
|
|
340
416
|
{{#if activeOutlook}}
|
|
341
|
-
|
|
342
417
|
<div>
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
</
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
<
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
personal Microsoft accounts (e.g. Skype, Xbox)
|
|
361
|
-
</label>
|
|
362
|
-
</div>
|
|
363
|
-
|
|
364
|
-
<div class="flex items-start gap-2">
|
|
365
|
-
<input class="radio radio-sm mt-0.5 r-auth" type="radio" name="authority" id="authorityConsumers"
|
|
366
|
-
value="consumers" {{#if authorityConsumers}}checked{{/if}}>
|
|
367
|
-
<label class="label-text p-0" for="authorityConsumers">
|
|
368
|
-
Personal Microsoft accounts only
|
|
369
|
-
</label>
|
|
370
|
-
</div>
|
|
371
|
-
|
|
372
|
-
<div class="flex items-start gap-2">
|
|
373
|
-
<input class="radio radio-sm mt-0.5 r-auth" type="radio" name="authority" id="authorityTenant"
|
|
374
|
-
value="tenant" {{#if authorityTenant}}checked{{/if}}>
|
|
375
|
-
<label class="label-text p-0" for="authorityTenant">
|
|
376
|
-
Accounts in the specified organizational directory only (Single tenant)
|
|
377
|
-
</label>
|
|
378
|
-
</div>
|
|
379
|
-
</div>
|
|
418
|
+
{{#> ui/form-field id="authority" label="Supported account types" error=errors.authority}}
|
|
419
|
+
<select class="select max-w-md{{#if errors.authority}} is-invalid{{/if}}" id="authority"
|
|
420
|
+
name="authority" required>
|
|
421
|
+
{{!-- an app stored without an account type gets no silent default: saving it asks --}}
|
|
422
|
+
{{#unless authorityCommon}}{{#unless authorityOrganizations}}{{#unless authorityConsumers}}{{#unless
|
|
423
|
+
authorityTenant}}<option value="" selected disabled>Choose...</option>{{/unless}}{{/unless}}{{/unless}}{{/unless}}
|
|
424
|
+
<option value="common" {{#if authorityCommon}}selected{{/if}}>Work, school and personal Microsoft
|
|
425
|
+
accounts</option>
|
|
426
|
+
<option value="organizations" {{#if authorityOrganizations}}selected{{/if}}>Work and school accounts
|
|
427
|
+
from any organization</option>
|
|
428
|
+
<option value="consumers" {{#if authorityConsumers}}selected{{/if}}>Personal Microsoft accounts only
|
|
429
|
+
</option>
|
|
430
|
+
<option value="tenant" {{#if authorityTenant}}selected{{/if}}>Work and school accounts from one
|
|
431
|
+
organization</option>
|
|
432
|
+
</select>
|
|
433
|
+
<span class="helper-text">Must match "Supported account types" in the app registration.</span>
|
|
434
|
+
{{/ui/form-field}}
|
|
380
435
|
</div>
|
|
381
436
|
|
|
382
|
-
<div>
|
|
437
|
+
<div class="{{#unless authorityTenant}}hidden{{/unless}}" id="tenant-field">
|
|
383
438
|
{{#> ui/form-field id="tenant" label="Directory (tenant) ID" error=errors.tenant}}
|
|
384
439
|
<input type="text" class="input{{#if errors.tenant}} is-invalid{{/if}}" id="tenant" name="tenant"
|
|
385
|
-
value="{{values.tenant}}"
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
"f8cdef31-a31e-4b4a-93e4-5f571e91255a"</span>
|
|
440
|
+
value="{{values.tenant}}" placeholder="For example "f8cdef31-a31e-4b4a-93e4-5f571e91255a""
|
|
441
|
+
{{#unless authorityTenant}}disabled{{/unless}} />
|
|
442
|
+
<span class="helper-text">From the Overview page of the app registration in Microsoft Entra.</span>
|
|
389
443
|
{{/ui/form-field}}
|
|
390
444
|
</div>
|
|
391
445
|
{{/if}}
|
|
392
446
|
|
|
393
|
-
|
|
447
|
+
{{#if activeOutlookService}}
|
|
394
448
|
|
|
395
449
|
<div>
|
|
396
|
-
{{#> ui/form-field id="
|
|
397
|
-
<input type="
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
450
|
+
{{#> ui/form-field id="authority" label="Directory (tenant) ID" error=errors.authority}}
|
|
451
|
+
<input type="text" class="input{{#if errors.authority}} is-invalid{{/if}}" id="authority" name="authority"
|
|
452
|
+
value="{{values.authority}}" placeholder="For example "f8cdef31-a31e-4b4a-93e4-5f571e91255a""
|
|
453
|
+
required />
|
|
454
|
+
<span class="helper-text">From the Overview page of the app registration. Application access always
|
|
455
|
+
needs a specific tenant.</span>
|
|
401
456
|
{{/ui/form-field}}
|
|
402
457
|
</div>
|
|
403
458
|
{{/if}}
|
|
404
459
|
|
|
405
|
-
|
|
406
|
-
</div>
|
|
407
|
-
|
|
408
|
-
{{#if activeGmailService}}
|
|
409
|
-
|
|
410
|
-
<div class="card bg-base-100 shadow-md mb-6">
|
|
411
|
-
|
|
412
|
-
<div class="card-header">
|
|
413
|
-
<h6 class="card-title text-primary">Base scopes</h6>
|
|
414
|
-
</div>
|
|
415
|
-
|
|
416
|
-
<div class="overflow-x-auto">
|
|
417
|
-
<table class="table">
|
|
418
|
-
|
|
419
|
-
<thead>
|
|
420
|
-
<tr>
|
|
421
|
-
<th>Type</th>
|
|
422
|
-
<th>Description</th>
|
|
423
|
-
<th>Requirements</th>
|
|
424
|
-
|
|
425
|
-
</tr>
|
|
426
|
-
|
|
427
|
-
</thead>
|
|
428
|
-
<tbody>
|
|
429
|
-
|
|
430
|
-
{{#if actionCreate}}
|
|
431
|
-
<tr>
|
|
432
|
-
<td>
|
|
433
|
-
<div class="flex items-center gap-2">
|
|
434
|
-
<input class="radio radio-sm base-scopes-radio" type="radio" name="baseScopes"
|
|
435
|
-
id="baseScopesImap" value="imap" {{#if baseScopesImap}}checked{{/if}}>
|
|
436
|
-
<label class="label-text p-0" for="baseScopesImap">
|
|
437
|
-
IMAP and SMTP
|
|
438
|
-
</label>
|
|
439
|
-
</div>
|
|
440
|
-
</td>
|
|
441
|
-
<td>Regular email protocols</td>
|
|
442
|
-
<td><code>"https://mail.google.com/"</code> consent screen scope</td>
|
|
443
|
-
|
|
444
|
-
</tr>
|
|
445
|
-
<tr>
|
|
446
|
-
<td>
|
|
447
|
-
<div class="flex items-center gap-2">
|
|
448
|
-
<input class="radio radio-sm base-scopes-radio" type="radio" name="baseScopes"
|
|
449
|
-
id="baseScopesAPI" value="api" {{#if baseScopesApi}}checked{{/if}}>
|
|
450
|
-
<label class="label-text p-0" for="baseScopesAPI">
|
|
451
|
-
Gmail API {{> ui/badge label="beta" variant="neutral"}}
|
|
452
|
-
</label>
|
|
453
|
-
</div>
|
|
454
|
-
</td>
|
|
455
|
-
<td>Gmail HTTP API, through domain-wide delegation</td>
|
|
456
|
-
<td><code>"/auth/gmail.modify"</code> delegated scope</td>
|
|
457
|
-
|
|
458
|
-
</tr>
|
|
459
|
-
<tr>
|
|
460
|
-
<td>
|
|
461
|
-
<div class="flex items-center gap-2">
|
|
462
|
-
<input class="radio radio-sm base-scopes-radio" type="radio" name="baseScopes"
|
|
463
|
-
id="baseScopesPubsub" value="pubsub" {{#if baseScopesPubsub}}checked{{/if}}>
|
|
464
|
-
<label class="label-text p-0" for="baseScopesPubsub">
|
|
465
|
-
Cloud Pub/Sub {{> ui/badge label="beta" variant="neutral"}}
|
|
466
|
-
</label>
|
|
467
|
-
</div>
|
|
468
|
-
</td>
|
|
469
|
-
<td>Webhook management</td>
|
|
470
|
-
<td><code>"Pub/Sub Admin"</code> service credentials role</td>
|
|
471
|
-
|
|
472
|
-
</tr>
|
|
473
|
-
|
|
474
|
-
{{else}}
|
|
475
|
-
{{#if baseScopesImap}}
|
|
476
|
-
<tr>
|
|
477
|
-
<td>
|
|
478
|
-
<strong>IMAP and SMTP</strong>
|
|
479
|
-
</td>
|
|
480
|
-
<td>Regular email protocols</td>
|
|
481
|
-
<td><code>"https://mail.google.com/"</code> consent screen scope</td>
|
|
482
|
-
|
|
483
|
-
</tr>
|
|
484
|
-
{{/if}}
|
|
485
|
-
|
|
486
|
-
{{#if baseScopesApi}}
|
|
487
|
-
<tr>
|
|
488
|
-
<td>
|
|
489
|
-
<strong>Gmail API</strong> {{> ui/badge label="beta" variant="neutral"}}
|
|
490
|
-
</td>
|
|
491
|
-
<td>Gmail HTTP API, through domain-wide delegation</td>
|
|
492
|
-
<td><code>"/auth/gmail.modify"</code> delegated scope</td>
|
|
493
|
-
|
|
494
|
-
</tr>
|
|
495
|
-
{{/if}}
|
|
496
|
-
|
|
497
|
-
{{#if baseScopesPubsub}}
|
|
498
|
-
<tr>
|
|
499
|
-
<td>
|
|
500
|
-
<strong>Cloud Pub/Sub</strong> {{> ui/badge label="beta" variant="neutral"}}
|
|
501
|
-
</td>
|
|
502
|
-
<td>Webhook management</td>
|
|
503
|
-
<td><code>"Pub/Sub Admin"</code> service credentials role</td>
|
|
504
|
-
|
|
505
|
-
</tr>
|
|
506
|
-
{{/if}}
|
|
507
|
-
|
|
508
|
-
{{/if}}
|
|
509
|
-
</tbody>
|
|
510
|
-
|
|
511
|
-
</table>
|
|
512
|
-
</div>
|
|
513
|
-
|
|
514
|
-
{{> oauth_pubsub_app_select}}
|
|
515
|
-
|
|
516
|
-
<div class="card-footer border-base-content/10 border-t px-6 py-4{{#unless baseScopesPubsub}} hidden{{/unless}}"
|
|
517
|
-
data-base-scopes="pubsub">
|
|
518
|
-
|
|
519
|
-
{{#if actionCreate}}
|
|
520
|
-
|
|
521
|
-
<div class="mb-4">
|
|
522
|
-
{{#> ui/form-field id="googleTopicName" label="Google Pub/Sub Topic Name" error=errors.googleTopicName}}
|
|
523
|
-
<input type="text" class="input{{#if errors.googleTopicName}} is-invalid{{/if}}" id="googleTopicName"
|
|
524
|
-
name="googleTopicName" value="{{values.googleTopicName}}"
|
|
525
|
-
placeholder="Enter the Topic Name for the Google Pub/Sub subscription, for example "ee-pub-12345"" />
|
|
526
|
-
<span class="helper-text">OAuth2 Pub/Sub Topic Name. Automatically generated if not set.</span>
|
|
527
|
-
{{/ui/form-field}}
|
|
528
|
-
</div>
|
|
529
|
-
|
|
460
|
+
{{#unless activeOutlookService}}
|
|
530
461
|
<div>
|
|
531
|
-
{{#> ui/form-field id="
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
462
|
+
{{#> ui/form-field id="redirectUrl" label="Redirect URL" error=errors.redirectUrl}}
|
|
463
|
+
<input type="url" class="input{{#if errors.redirectUrl}} is-invalid{{/if}}" id="redirectUrl"
|
|
464
|
+
name="redirectUrl" value="{{values.redirectUrl}}" required />
|
|
465
|
+
<span class="helper-text">
|
|
466
|
+
{{#if activeGmail}}Add it to the authorized redirect URIs of the OAuth client.{{/if}}
|
|
467
|
+
{{#if activeOutlook}}Add it as a Web redirect URI under Authentication in the app registration.{{/if}}
|
|
468
|
+
{{#if activeMailRu}}Add it to the redirect URIs of your Mail.ru application.{{/if}}
|
|
469
|
+
Change it only if you run your own OAuth2 flow; EmailEngine's own is
|
|
470
|
+
<code>{{defaultRedirectUrl}}</code>.
|
|
471
|
+
</span>
|
|
537
472
|
{{/ui/form-field}}
|
|
538
473
|
</div>
|
|
539
|
-
|
|
540
|
-
{{else}}
|
|
541
|
-
|
|
542
|
-
<dl class="ee-dl">
|
|
543
|
-
|
|
544
|
-
<dt>Pub/Sub Topic</dt>
|
|
545
|
-
<dd>
|
|
546
|
-
{{#if appData.pubSubTopic}}
|
|
547
|
-
|
|
548
|
-
<code>{{lastVal appData.pubSubTopic "/"}}</code>
|
|
549
|
-
{{else}}
|
|
550
|
-
Not initialized
|
|
551
|
-
{{/if}}
|
|
552
|
-
</dd>
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
<dt>Pub/Sub Subscription</dt>
|
|
556
|
-
<dd>
|
|
557
|
-
{{#if appData.pubSubSubscription}}
|
|
558
|
-
<code>{{lastVal appData.pubSubSubscription "/"}}</code>
|
|
559
|
-
{{else}}
|
|
560
|
-
Not initialized
|
|
561
|
-
{{/if}}
|
|
562
|
-
</dd>
|
|
563
|
-
</dl>
|
|
564
|
-
|
|
474
|
+
{{/unless}}
|
|
565
475
|
|
|
566
476
|
{{/if}}
|
|
567
477
|
|
|
568
478
|
</div>
|
|
569
|
-
|
|
570
479
|
</div>
|
|
571
|
-
{{/if}}
|
|
572
|
-
|
|
573
|
-
{{#if activeGmail}}
|
|
574
|
-
|
|
575
|
-
<div class="card bg-base-100 shadow-md mb-6">
|
|
576
|
-
|
|
577
|
-
<div class="card-header">
|
|
578
|
-
<h6 class="card-title text-primary">Base scopes</h6>
|
|
579
|
-
</div>
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
<div class="overflow-x-auto">
|
|
583
|
-
<table class="table">
|
|
584
|
-
|
|
585
|
-
<thead>
|
|
586
|
-
<tr>
|
|
587
|
-
<th>Type</th>
|
|
588
|
-
<th>Description</th>
|
|
589
|
-
<th>Requirements</th>
|
|
590
|
-
</tr>
|
|
591
480
|
|
|
592
|
-
|
|
593
|
-
|
|
481
|
+
{{#> ui/details summary="Custom scopes" summarySmall="Optional" id="setupScopes" class="card bg-base-100 shadow-md mb-6"
|
|
482
|
+
bodyClass="space-y-4 wrap-anywhere"
|
|
483
|
+
open=(when values.extraScopes true values.skipScopes)}}
|
|
484
|
+
<p>Add scopes beyond the defaults, for example when your application uses the access tokens for other services,
|
|
485
|
+
or drop default scopes your integration does not need.</p>
|
|
594
486
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
id="baseScopesImap" value="imap" {{#if baseScopesImap}}checked{{/if}}>
|
|
601
|
-
<label class="label-text p-0" for="baseScopesImap">
|
|
602
|
-
IMAP and SMTP
|
|
603
|
-
</label>
|
|
604
|
-
</div>
|
|
605
|
-
</td>
|
|
606
|
-
<td>Regular email protocols</td>
|
|
607
|
-
<td><code>"https://mail.google.com/"</code> consent screen scope</td>
|
|
608
|
-
|
|
609
|
-
</tr>
|
|
610
|
-
<tr>
|
|
611
|
-
<td>
|
|
612
|
-
<div class="flex items-center gap-2">
|
|
613
|
-
<input class="radio radio-sm base-scopes-radio" type="radio" name="baseScopes"
|
|
614
|
-
id="baseScopesAPI" value="api" {{#if baseScopesApi}}checked{{/if}}>
|
|
615
|
-
<label class="label-text p-0" for="baseScopesAPI">
|
|
616
|
-
Gmail API {{> ui/badge label="beta" variant="neutral"}}
|
|
617
|
-
</label>
|
|
618
|
-
</div>
|
|
619
|
-
</td>
|
|
620
|
-
<td>Gmail HTTP API</td>
|
|
621
|
-
<td><code>"/auth/gmail.modify"</code> consent screen scope</td>
|
|
622
|
-
|
|
623
|
-
</tr>
|
|
624
|
-
|
|
625
|
-
{{else}}
|
|
626
|
-
|
|
627
|
-
{{#if baseScopesImap}}
|
|
628
|
-
<tr>
|
|
629
|
-
<td>
|
|
630
|
-
<strong>IMAP and SMTP</strong>
|
|
631
|
-
</td>
|
|
632
|
-
<td>Regular email protocols</td>
|
|
633
|
-
<td><code>"https://mail.google.com/"</code> consent screen scope</td>
|
|
634
|
-
|
|
635
|
-
</tr>
|
|
636
|
-
{{/if}}
|
|
637
|
-
|
|
638
|
-
{{#if baseScopesApi}}
|
|
639
|
-
<tr>
|
|
640
|
-
<td>
|
|
641
|
-
<strong>Gmail API</strong> {{> ui/badge label="beta" variant="neutral"}}
|
|
642
|
-
</td>
|
|
643
|
-
<td>Gmail HTTP API</td>
|
|
644
|
-
<td><code>"/auth/gmail.modify"</code> consent screen scope</td>
|
|
645
|
-
|
|
646
|
-
</tr>
|
|
647
|
-
{{/if}}
|
|
648
|
-
|
|
649
|
-
{{/if}}
|
|
650
|
-
</tbody>
|
|
651
|
-
</table>
|
|
652
|
-
</div>
|
|
653
|
-
|
|
654
|
-
{{> oauth_pubsub_app_select}}
|
|
655
|
-
|
|
656
|
-
</div>
|
|
487
|
+
{{#if providerData.gmailApi}}
|
|
488
|
+
<div class="alert alert-soft alert-info block">Enable the matching APIs for the project (<em>Enabled APIs &
|
|
489
|
+
services</em> in the <a href="https://console.cloud.google.com/apis/dashboard" target="_blank"
|
|
490
|
+
rel="noopener noreferrer" referrerpolicy="no-referrer" class="link link-animated">Google Cloud console</a>)
|
|
491
|
+
before adding accounts with new scopes, or token requests will fail.</div>
|
|
657
492
|
{{/if}}
|
|
658
493
|
|
|
659
|
-
|
|
660
494
|
{{#if activeOutlook}}
|
|
661
|
-
|
|
662
|
-
<
|
|
663
|
-
|
|
664
|
-
<div class="card-header">
|
|
665
|
-
<h6 class="card-title text-primary">Base scopes</h6>
|
|
666
|
-
</div>
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
<div class="overflow-x-auto">
|
|
670
|
-
<table class="table">
|
|
671
|
-
|
|
672
|
-
<thead>
|
|
673
|
-
<tr>
|
|
674
|
-
<th>Type</th>
|
|
675
|
-
<th>Description</th>
|
|
676
|
-
<th>Requirements</th>
|
|
677
|
-
</tr>
|
|
678
|
-
|
|
679
|
-
</thead>
|
|
680
|
-
<tbody>
|
|
681
|
-
|
|
682
|
-
{{#if actionCreate}}
|
|
683
|
-
<tr>
|
|
684
|
-
<td>
|
|
685
|
-
<div class="flex items-center gap-2">
|
|
686
|
-
<input class="radio radio-sm base-scopes-radio" type="radio" name="baseScopes"
|
|
687
|
-
id="baseScopesImap" value="imap" {{#if baseScopesImap}}checked{{/if}}>
|
|
688
|
-
<label class="label-text p-0" for="baseScopesImap">
|
|
689
|
-
IMAP and SMTP
|
|
690
|
-
</label>
|
|
691
|
-
</div>
|
|
692
|
-
</td>
|
|
693
|
-
<td>Regular email protocols</td>
|
|
694
|
-
<td><code>"IMAP.AccessAsUser.All"</code> and <code>"SMTP.Send"</code> consent screen scopes</td>
|
|
695
|
-
|
|
696
|
-
</tr>
|
|
697
|
-
<tr>
|
|
698
|
-
<td>
|
|
699
|
-
<div class="flex items-center gap-2">
|
|
700
|
-
<input class="radio radio-sm base-scopes-radio" type="radio" name="baseScopes"
|
|
701
|
-
id="baseScopesAPI" value="api" {{#if baseScopesApi}}checked{{/if}}>
|
|
702
|
-
<label class="label-text p-0" for="baseScopesAPI">
|
|
703
|
-
MS Graph API {{> ui/badge label="beta" variant="neutral"}}
|
|
704
|
-
</label>
|
|
705
|
-
</div>
|
|
706
|
-
</td>
|
|
707
|
-
<td>Microsoft HTTP API</td>
|
|
708
|
-
<td><code>"Mail.ReadWrite"</code> and <code>"Mail.Send"</code> consent screen scopes</td>
|
|
709
|
-
|
|
710
|
-
</tr>
|
|
711
|
-
|
|
712
|
-
{{else}}
|
|
713
|
-
|
|
714
|
-
{{#if baseScopesImap}}
|
|
715
|
-
<tr>
|
|
716
|
-
<td>
|
|
717
|
-
<strong>IMAP and SMTP</strong>
|
|
718
|
-
</td>
|
|
719
|
-
<td>Regular email protocols</td>
|
|
720
|
-
<td><code>"IMAP.AccessAsUser.All"</code> and <code>"SMTP.Send"</code> consent screen scopes</td>
|
|
721
|
-
|
|
722
|
-
</tr>
|
|
723
|
-
{{/if}}
|
|
724
|
-
|
|
725
|
-
{{#if baseScopesApi}}
|
|
726
|
-
<tr>
|
|
727
|
-
<td>
|
|
728
|
-
<strong>MS Graph API</strong> {{> ui/badge label="beta" variant="neutral"}}
|
|
729
|
-
</td>
|
|
730
|
-
<td>Microsoft HTTP API</td>
|
|
731
|
-
<td><code>"Mail.ReadWrite"</code> and <code>"Mail.Send"</code> consent screen scopes</td>
|
|
732
|
-
|
|
733
|
-
</tr>
|
|
734
|
-
{{/if}}
|
|
735
|
-
|
|
736
|
-
{{/if}}
|
|
737
|
-
</tbody>
|
|
738
|
-
</table>
|
|
739
|
-
</div>
|
|
740
|
-
|
|
741
|
-
<div class="card-footer border-base-content/10 border-t px-6 py-4{{#unless baseScopesApi}} hidden{{/unless}}"
|
|
742
|
-
data-base-scopes="api">
|
|
743
|
-
|
|
744
|
-
<p class="mb-2">Microsoft Graph delivers change notifications to EmailEngine at these two endpoints:</p>
|
|
745
|
-
|
|
746
|
-
<pre class="ee-code-block mb-2"><code>{{mainServiceUrl}}/oauth/msg/lifecycle
|
|
747
|
-
{{mainServiceUrl}}/oauth/msg/notification</code></pre>
|
|
748
|
-
|
|
749
|
-
<p class="mb-2">
|
|
750
|
-
Both endpoints must be publicly reachable for anonymous HTTPS
|
|
751
|
-
<strong>POST</strong> requests. When a notification arrives, EmailEngine
|
|
752
|
-
processes the change and sends matching events through your configured webhooks.
|
|
753
|
-
</p>
|
|
754
|
-
|
|
755
|
-
<p>
|
|
756
|
-
If your EmailEngine instance cannot be exposed directly, configure a public
|
|
757
|
-
proxy domain in <span class="text-base-content/60 code-link"><a
|
|
758
|
-
href="/admin/reference/settings#postV1Settings" target="_blank" rel="noopener noreferrer"
|
|
759
|
-
class="link link-animated">notificationBaseUrl</a></span>. Microsoft Graph will then
|
|
760
|
-
post to <code>https://<proxy-domain>/oauth/msg/...</code> instead of
|
|
761
|
-
<code>{{mainServiceUrl}}</code>.
|
|
762
|
-
</p>
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
</div>
|
|
766
|
-
</div>
|
|
767
|
-
|
|
495
|
+
<div class="alert alert-soft alert-info block">A Microsoft token is issued for one API, so every scope must come
|
|
496
|
+
from <code>{{#if baseScopesApi}}https://graph.microsoft.com/{{else}}https://outlook.office.com/{{/if}}</code>
|
|
497
|
+
while this app uses {{#if baseScopesApi}}MS Graph API{{else}}IMAP and SMTP{{/if}}.</div>
|
|
768
498
|
{{/if}}
|
|
769
499
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
500
|
+
<div class="grid gap-4 md:grid-cols-2">
|
|
501
|
+
<div>
|
|
502
|
+
{{#> ui/form-field id="extraScopes" label="Additional scopes" error=errors.extraScopes}}
|
|
503
|
+
<textarea class="textarea w-full font-mono{{#if errors.extraScopes}} is-invalid{{/if}}" id="extraScopes"
|
|
504
|
+
name="extraScopes" rows="5" spellcheck="false" data-enable-grammarly="false"
|
|
505
|
+
placeholder="One scope per line">{{values.extraScopes}}</textarea>
|
|
506
|
+
<span class="helper-text">Requested on top of the defaults.</span>
|
|
507
|
+
{{/ui/form-field}}
|
|
776
508
|
</div>
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
<
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
509
|
+
<div>
|
|
510
|
+
{{#> ui/form-field id="skipScopesList" label="Disabled scopes" error=errors.skipScopes}}
|
|
511
|
+
<textarea class="textarea w-full font-mono{{#if errors.skipScopes}} is-invalid{{/if}}" id="skipScopesList"
|
|
512
|
+
name="skipScopes" rows="5" spellcheck="false" data-enable-grammarly="false"
|
|
513
|
+
placeholder="One scope per line">{{values.skipScopes}}</textarea>
|
|
514
|
+
<span class="helper-text">Default scopes to leave out, such as
|
|
515
|
+
{{#if providerData.gmailApi}}<code>https://www.googleapis.com/auth/gmail.modify</code>{{else}}<code>SMTP.Send</code>{{/if}}.</span>
|
|
516
|
+
{{/ui/form-field}}
|
|
783
517
|
</div>
|
|
784
|
-
|
|
785
|
-
<div class="card-footer border-base-content/10 border-t px-6 py-4">
|
|
786
|
-
|
|
787
|
-
<p class="mb-2">Microsoft Graph delivers change notifications to EmailEngine at these two endpoints:</p>
|
|
788
|
-
|
|
789
|
-
<pre class="ee-code-block mb-2"><code>{{mainServiceUrl}}/oauth/msg/lifecycle
|
|
790
|
-
{{mainServiceUrl}}/oauth/msg/notification</code></pre>
|
|
791
|
-
|
|
792
|
-
<p class="mb-2">
|
|
793
|
-
Both endpoints must be publicly reachable for anonymous HTTPS
|
|
794
|
-
<strong>POST</strong> requests. When a notification arrives, EmailEngine
|
|
795
|
-
processes the change and sends matching events through your configured webhooks.
|
|
796
|
-
</p>
|
|
797
|
-
|
|
798
|
-
<p>
|
|
799
|
-
If your EmailEngine instance cannot be exposed directly, configure a public
|
|
800
|
-
proxy domain in <span class="text-base-content/60 code-link"><a
|
|
801
|
-
href="/admin/reference/settings#postV1Settings" target="_blank" rel="noopener noreferrer"
|
|
802
|
-
class="link link-animated">notificationBaseUrl</a></span>. Microsoft Graph will then
|
|
803
|
-
post to <code>https://<proxy-domain>/oauth/msg/...</code> instead of
|
|
804
|
-
<code>{{mainServiceUrl}}</code>.
|
|
805
|
-
</p>
|
|
806
|
-
|
|
807
|
-
</div>
|
|
808
|
-
</div>
|
|
809
|
-
|
|
810
|
-
{{/if}}
|
|
811
|
-
|
|
812
|
-
{{!-- Guarded on providerData.gmailApi, not on one provider: a service account in Gmail API mode takes
|
|
813
|
-
the same delegated scopes an interactive app takes, so the presets apply to it too. --}}
|
|
814
|
-
{{#if providerData.gmailApi}}
|
|
815
|
-
<div class="card bg-base-100 shadow-md mb-6{{#unless baseScopesApi}} hidden{{/unless}}" id="account-type-card-gmail">
|
|
816
|
-
<div class="card-header">
|
|
817
|
-
<h6 class="card-title text-primary">Scope presets</h6>
|
|
818
|
-
</div>
|
|
819
|
-
<div class="card-body">
|
|
820
|
-
<p class="mb-4">Choose a preset to fill in the scope fields below:</p>
|
|
821
|
-
|
|
822
|
-
<div class="join mb-4" role="group">
|
|
823
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
824
|
-
data-type="normal" data-provider="gmail">
|
|
825
|
-
Full access
|
|
826
|
-
</button>
|
|
827
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
828
|
-
data-type="readonly" data-provider="gmail">
|
|
829
|
-
Read-Only
|
|
830
|
-
</button>
|
|
831
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
832
|
-
data-type="readonlysend" data-provider="gmail">
|
|
833
|
-
Read-Only + Send
|
|
834
|
-
</button>
|
|
835
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
836
|
-
data-type="sendonly" data-provider="gmail">
|
|
837
|
-
Send-Only
|
|
838
|
-
</button>
|
|
839
|
-
</div>
|
|
840
|
-
|
|
841
|
-
<div class="mt-2">
|
|
842
|
-
<small class="text-base-content/60">
|
|
843
|
-
<strong>Full access:</strong> Default Gmail API scopes for full mailbox access<br>
|
|
844
|
-
<strong>Read-Only:</strong> Uses <code>gmail.readonly</code> scope for read-only access (no send)<br>
|
|
845
|
-
<strong>Read-Only + Send:</strong> Uses <code>gmail.readonly</code> and <code>gmail.send</code>
|
|
846
|
-
scopes<br>
|
|
847
|
-
<strong>Send-Only:</strong> Uses <code>gmail.send</code> scope only. Does not require privileged scope
|
|
848
|
-
approval from Google.
|
|
849
|
-
</small>
|
|
850
|
-
</div>
|
|
851
|
-
|
|
852
|
-
<div class="alert alert-soft alert-info mt-4 mb-0 block">
|
|
853
|
-
<p class="mb-2"><strong>Tip:</strong> Send-only accounts are useful when you only need to send emails and
|
|
854
|
-
don't want to request privileged scopes that require Google verification.</p>
|
|
855
|
-
<p class="mb-0"><strong>Important limitation:</strong> Messages sent through send-only accounts cannot be
|
|
856
|
-
tracked by EmailEngine. The Gmail API modifies the Message-ID header when sending emails, and without
|
|
857
|
-
read permissions, EmailEngine cannot resolve the new Message-ID assigned by Gmail. This means delivery
|
|
858
|
-
status and bounce notifications may not be accurately associated with the sent message.</p>
|
|
859
|
-
</div>
|
|
860
|
-
</div>
|
|
861
|
-
</div>
|
|
862
|
-
{{/if}}
|
|
863
|
-
|
|
864
|
-
{{#if activeOutlook}}
|
|
865
|
-
<div class="card bg-base-100 shadow-md mb-6{{#unless baseScopesApi}} hidden{{/unless}}" id="account-type-card-outlook">
|
|
866
|
-
<div class="card-header">
|
|
867
|
-
<h6 class="card-title text-primary">Scope presets</h6>
|
|
868
|
-
</div>
|
|
869
|
-
<div class="card-body">
|
|
870
|
-
<p class="mb-4">Choose a preset to fill in the scope fields below:</p>
|
|
871
|
-
|
|
872
|
-
<div class="join mb-4" role="group">
|
|
873
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
874
|
-
data-type="normal" data-provider="outlook">
|
|
875
|
-
Full access
|
|
876
|
-
</button>
|
|
877
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
878
|
-
data-type="readonly" data-provider="outlook">
|
|
879
|
-
Read-Only
|
|
880
|
-
</button>
|
|
881
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
882
|
-
data-type="readonlysend" data-provider="outlook">
|
|
883
|
-
Read-Only + Send
|
|
884
|
-
</button>
|
|
885
|
-
<button type="button" class="btn btn-outline btn-primary btn-sm join-item account-type-btn"
|
|
886
|
-
data-type="sendonly" data-provider="outlook">
|
|
887
|
-
Send-Only
|
|
888
|
-
</button>
|
|
889
|
-
</div>
|
|
890
|
-
|
|
891
|
-
<div class="mt-2">
|
|
892
|
-
<small class="text-base-content/60">
|
|
893
|
-
<strong>Full access:</strong> Default MS Graph API scopes for full mailbox access<br>
|
|
894
|
-
<strong>Read-Only:</strong> Uses <code>Mail.Read</code> scope for read-only access (no send)<br>
|
|
895
|
-
<strong>Read-Only + Send:</strong> Uses <code>Mail.Read</code> with <code>Mail.Send</code> enabled<br>
|
|
896
|
-
<strong>Send-Only:</strong> Uses <code>Mail.Send</code> scope only (disables
|
|
897
|
-
<code>Mail.ReadWrite</code>)
|
|
898
|
-
</small>
|
|
899
|
-
</div>
|
|
900
|
-
</div>
|
|
901
|
-
</div>
|
|
902
|
-
{{/if}}
|
|
903
|
-
|
|
904
|
-
{{#> ui/details summary="Additional scopes" id="setupScopes" class="card bg-base-100 shadow-md mb-6"
|
|
905
|
-
open=values.extraScopes}}
|
|
906
|
-
|
|
907
|
-
<p class="mb-4">Request additional OAuth2 scopes, for example when your application uses the provider access tokens
|
|
908
|
-
for services beyond email.</p>
|
|
909
|
-
|
|
910
|
-
{{#if providerData.gmailApi}}
|
|
911
|
-
<div class="alert alert-soft alert-info mb-4 block">
|
|
912
|
-
<p>When adding new scopes, ensure that related APIs are
|
|
913
|
-
enabled for your OAuth2 app (look for <em>Enabled APIs & services</em> in <a
|
|
914
|
-
href="https://console.cloud.google.com/apis/dashboard" target="_blank" rel="noopener noreferrer"
|
|
915
|
-
referrerpolicy="no-referrer" class="link link-animated">Google Cloud Console</a>)
|
|
916
|
-
before registering accounts with these permissions. Otherwise, token generation will fail.</p>
|
|
917
|
-
</div>
|
|
918
|
-
{{/if}}
|
|
919
|
-
|
|
920
|
-
{{#if activeOutlook}}
|
|
921
|
-
<div class="alert alert-soft alert-info mb-4"><span>
|
|
922
|
-
|
|
923
|
-
{{#if baseScopesImap}}
|
|
924
|
-
All scopes must come exclusively from <code>https://outlook.office.com/</code>; scopes from
|
|
925
|
-
<code>https://graph.microsoft.com/</code> are not allowed.
|
|
926
|
-
{{/if}}
|
|
927
|
-
|
|
928
|
-
{{#if baseScopesApi}}
|
|
929
|
-
All scopes must come exclusively from <code>https://graph.microsoft.com/</code>; scopes from
|
|
930
|
-
<code>https://outlook.office.com/</code> are not allowed.
|
|
931
|
-
{{/if}}
|
|
932
|
-
|
|
933
|
-
You cannot mix APIs from different endpoints within a single application.
|
|
934
|
-
|
|
935
|
-
</span>
|
|
936
|
-
</div>
|
|
937
|
-
{{/if}}
|
|
938
|
-
|
|
939
|
-
<div>
|
|
940
|
-
{{#> ui/form-field id="extraScopes" label="List of OAuth2 scopes" error=errors.extraScopes}}
|
|
941
|
-
<textarea class="textarea w-full font-mono{{#if errors.extraScopes}} is-invalid{{/if}}" id="extraScopes"
|
|
942
|
-
name="extraScopes" rows="5" spellcheck="false" data-enable-grammarly="false"
|
|
943
|
-
placeholder="Scope identifiers like "https://mail.google.com/"…">{{values.extraScopes}}</textarea>
|
|
944
|
-
<span class="helper-text">Enter one scope per line.</span>
|
|
945
|
-
{{/ui/form-field}}
|
|
946
|
-
</div>
|
|
947
|
-
|
|
948
|
-
{{/ui/details}}
|
|
949
|
-
|
|
950
|
-
{{#> ui/details summary="Disabled scopes" id="skipScopes" class="card bg-base-100 shadow-md mb-6"
|
|
951
|
-
open=values.skipScopes}}
|
|
952
|
-
|
|
953
|
-
<p class="mb-4">Exclude default OAuth2 scopes that your integration does not need, such as <code>"SMTP.Send"</code> in Outlook or
|
|
954
|
-
<code>"https://www.googleapis.com/auth/gmail.modify"</code> in Gmail.
|
|
955
|
-
</p>
|
|
956
|
-
|
|
957
|
-
<div>
|
|
958
|
-
{{#> ui/form-field id="skipScopesList" label="List of disabled OAuth2 scopes" error=errors.skipScopes}}
|
|
959
|
-
<textarea class="textarea w-full font-mono{{#if errors.skipScopes}} is-invalid{{/if}}" id="skipScopesList"
|
|
960
|
-
name="skipScopes" rows="5" spellcheck="false" data-enable-grammarly="false"
|
|
961
|
-
placeholder="Scope identifiers like "SMTP.Send"…">{{values.skipScopes}}</textarea>
|
|
962
|
-
<span class="helper-text">Enter one scope per line.</span>
|
|
963
|
-
{{/ui/form-field}}
|
|
964
518
|
</div>
|
|
965
|
-
|
|
966
519
|
{{/ui/details}}
|
|
967
520
|
|
|
968
521
|
<script data-cfasync="false" nonce="{{cspNonce}}">
|
|
@@ -973,12 +526,8 @@ open=values.skipScopes}}
|
|
|
973
526
|
const pubSubAppElm = document.getElementById('pubSubApp');
|
|
974
527
|
|
|
975
528
|
/**
|
|
976
|
-
* Shows the
|
|
977
|
-
*
|
|
978
|
-
* Each toggled section declares the value that reveals it with `data-base-scopes`, rather than
|
|
979
|
-
* being looked up by element id: a service-account app offers both `api` and `pubsub` and so
|
|
980
|
-
* carries two of them in one block, which two hardcoded id lookups could not express - they
|
|
981
|
-
* both reached for the same element and fought over it.
|
|
529
|
+
* Shows the panel whose data-base-scopes matches the selected base scope, and disables the
|
|
530
|
+
* Pub/Sub selector while its panel is hidden.
|
|
982
531
|
*/
|
|
983
532
|
function checkScopesRadio() {
|
|
984
533
|
let selected = document.querySelector('.base-scopes-radio:checked');
|
|
@@ -1006,15 +555,10 @@ open=values.skipScopes}}
|
|
|
1006
555
|
pubSubAppElm.disabled = !shownElm || !shownElm.contains(pubSubAppElm);
|
|
1007
556
|
}
|
|
1008
557
|
|
|
1009
|
-
// The account type card describes what an API-based app can do with an account
|
|
1010
|
-
document.querySelectorAll('#account-type-card-gmail, #account-type-card-outlook').forEach(cardElm => {
|
|
1011
|
-
cardElm.classList.toggle('hidden', selected.value !== 'api');
|
|
1012
|
-
});
|
|
1013
558
|
}
|
|
1014
559
|
|
|
1015
560
|
document.querySelectorAll('.base-scopes-radio').forEach(radioElm => {
|
|
1016
561
|
radioElm.addEventListener('change', checkScopesRadio);
|
|
1017
|
-
radioElm.addEventListener('click', checkScopesRadio);
|
|
1018
562
|
});
|
|
1019
563
|
|
|
1020
564
|
checkScopesRadio();
|
|
@@ -1045,8 +589,7 @@ open=values.skipScopes}}
|
|
|
1045
589
|
}
|
|
1046
590
|
|
|
1047
591
|
if (projectIdElm && pubSubAppElm) {
|
|
1048
|
-
projectIdElm.addEventListener('
|
|
1049
|
-
projectIdElm.addEventListener('change', filterPubSubApps)
|
|
592
|
+
projectIdElm.addEventListener('input', filterPubSubApps)
|
|
1050
593
|
filterPubSubApps()
|
|
1051
594
|
}
|
|
1052
595
|
|
|
@@ -1076,7 +619,10 @@ open=values.skipScopes}}
|
|
|
1076
619
|
}
|
|
1077
620
|
|
|
1078
621
|
document.getElementById('clientId').value = data.web.client_id;
|
|
1079
|
-
document.getElementById('clientSecret')
|
|
622
|
+
let clientSecretElm = document.getElementById('clientSecret');
|
|
623
|
+
clientSecretElm.value = data.web.client_secret;
|
|
624
|
+
// ui/secret-field enables its reveal and copy buttons on input, which a script write does not fire
|
|
625
|
+
clientSecretElm.dispatchEvent(new Event('input', { bubbles: true }));
|
|
1080
626
|
|
|
1081
627
|
document.getElementById('googleProjectId').value = data.web.project_id || '';
|
|
1082
628
|
|
|
@@ -1096,39 +642,26 @@ open=values.skipScopes}}
|
|
|
1096
642
|
});
|
|
1097
643
|
}
|
|
1098
644
|
|
|
1099
|
-
|
|
645
|
+
// The tenant ID applies to the single-tenant choice only, so it is shown, required and submitted
|
|
646
|
+
// only while that choice is selected
|
|
647
|
+
let authorityElm = document.querySelector('select#authority');
|
|
648
|
+
let tenantFieldElm = document.getElementById('tenant-field');
|
|
1100
649
|
let tenantElm = document.getElementById('tenant');
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
showtenant = true
|
|
1111
|
-
}
|
|
1112
|
-
break;
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
tenantElm.disabled = !showtenant;
|
|
1116
|
-
tenantElm.required = showtenant;
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
for (let aElm of authorityElms) {
|
|
1120
|
-
aElm.addEventListener('click', checkAuthorityState)
|
|
1121
|
-
aElm.addEventListener('change', checkAuthorityState)
|
|
650
|
+
if (authorityElm && tenantFieldElm && tenantElm) {
|
|
651
|
+
let checkAuthorityState = () => {
|
|
652
|
+
let single = authorityElm.value === 'tenant';
|
|
653
|
+
tenantFieldElm.classList.toggle('hidden', !single);
|
|
654
|
+
tenantElm.disabled = !single;
|
|
655
|
+
tenantElm.required = single;
|
|
656
|
+
};
|
|
657
|
+
authorityElm.addEventListener('change', checkAuthorityState);
|
|
658
|
+
checkAuthorityState();
|
|
1122
659
|
}
|
|
1123
660
|
|
|
1124
|
-
checkAuthorityState();
|
|
1125
|
-
|
|
1126
|
-
// Account type helper for API mode
|
|
1127
661
|
const accountTypeButtons = document.querySelectorAll('.account-type-btn');
|
|
1128
662
|
const extraScopesElm = document.querySelector('textarea#extraScopes');
|
|
1129
663
|
const skipScopesElm = document.querySelector('textarea[name="skipScopes"]');
|
|
1130
|
-
const
|
|
1131
|
-
const skipScopesCard = document.getElementById('skipScopes');
|
|
664
|
+
const customScopesCard = document.getElementById('setupScopes');
|
|
1132
665
|
|
|
1133
666
|
// Scope configurations
|
|
1134
667
|
const scopeConfigs = {
|
|
@@ -1189,7 +722,6 @@ open=values.skipScopes}}
|
|
|
1189
722
|
return;
|
|
1190
723
|
}
|
|
1191
724
|
|
|
1192
|
-
// Get the appropriate config
|
|
1193
725
|
let config = scopeConfigs[provider] && scopeConfigs[provider][type];
|
|
1194
726
|
|
|
1195
727
|
if (!config) {
|
|
@@ -1216,35 +748,22 @@ open=values.skipScopes}}
|
|
|
1216
748
|
extraScopesElm.value = newExtraScopes.join('\n');
|
|
1217
749
|
skipScopesElm.value = newSkipScopes.join('\n');
|
|
1218
750
|
|
|
1219
|
-
// Expand
|
|
1220
|
-
|
|
1221
|
-
skipScopesCard.open = newSkipScopes.length > 0;
|
|
751
|
+
// Expand the custom scopes card when the preset left anything in it
|
|
752
|
+
customScopesCard.open = newExtraScopes.length > 0 || newSkipScopes.length > 0;
|
|
1222
753
|
}
|
|
1223
754
|
|
|
1224
|
-
//
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
},
|
|
1236
|
-
outlook: {
|
|
1237
|
-
extra: [
|
|
1238
|
-
'Mail.Read'
|
|
1239
|
-
],
|
|
1240
|
-
skip: [
|
|
1241
|
-
'Mail.ReadWrite',
|
|
1242
|
-
'Mail.Send'
|
|
1243
|
-
]
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
755
|
+
// The scopes the preset buttons own: every scope any preset adds or skips. Derived from the presets
|
|
756
|
+
// so a scope added to one cannot be left behind when another preset replaces it
|
|
757
|
+
const managedScopes = Object.fromEntries(
|
|
758
|
+
Object.entries(scopeConfigs).map(([provider, presets]) => [
|
|
759
|
+
provider,
|
|
760
|
+
{
|
|
761
|
+
extra: [...new Set(Object.values(presets).flatMap(preset => preset.extraScopes))],
|
|
762
|
+
skip: [...new Set(Object.values(presets).flatMap(preset => preset.skipScopes))]
|
|
763
|
+
}
|
|
764
|
+
])
|
|
765
|
+
);
|
|
1246
766
|
|
|
1247
|
-
// Attach event listeners to buttons
|
|
1248
767
|
for (let btn of accountTypeButtons) {
|
|
1249
768
|
btn.addEventListener('click', function () {
|
|
1250
769
|
const provider = this.getAttribute('data-provider');
|
|
@@ -1254,7 +773,7 @@ open=values.skipScopes}}
|
|
|
1254
773
|
}
|
|
1255
774
|
|
|
1256
775
|
// Shared by the new/edit pages: gmailService credential-file loaders
|
|
1257
|
-
// and the auth-method
|
|
776
|
+
// and the auth-method strip (all target markup in this partial)
|
|
1258
777
|
|
|
1259
778
|
let serviceFileElm = document.getElementById('serviceFile');
|
|
1260
779
|
if (serviceFileElm) {
|
|
@@ -1312,7 +831,7 @@ open=values.skipScopes}}
|
|
|
1312
831
|
|
|
1313
832
|
if (data.type !== 'external_account') {
|
|
1314
833
|
if (data.type === 'service_account') {
|
|
1315
|
-
return showToast('This is a service account key file, not a Workload Identity Federation config.
|
|
834
|
+
return showToast('This is a service account key file, not a Workload Identity Federation config. Choose the "Service account key" tab to load it.', 'alert-triangle');
|
|
1316
835
|
}
|
|
1317
836
|
return showToast(`Selected file is not an external_account credential config (type: ${data.type || 'missing'})`, 'alert-triangle');
|
|
1318
837
|
}
|
|
@@ -1336,31 +855,99 @@ open=values.skipScopes}}
|
|
|
1336
855
|
});
|
|
1337
856
|
}
|
|
1338
857
|
|
|
1339
|
-
let
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
let
|
|
858
|
+
let authMethodRadios = document.querySelectorAll('.auth-method-radio');
|
|
859
|
+
if (authMethodRadios.length) {
|
|
860
|
+
let noticeElm = document.getElementById('authMethodNotice');
|
|
861
|
+
let scopeBadgeElm = document.getElementById('authMethodScopeBadge');
|
|
862
|
+
let pubsubScopeElm = document.getElementById('baseScopesPubsub');
|
|
863
|
+
|
|
864
|
+
let showNotice = text => {
|
|
865
|
+
noticeElm.textContent = text;
|
|
866
|
+
noticeElm.classList.toggle('hidden', !text);
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
let selectedMethod = () => document.querySelector('.auth-method-radio:checked').value;
|
|
870
|
+
|
|
871
|
+
let updateSections = () => {
|
|
872
|
+
let selected = selectedMethod();
|
|
1343
873
|
document.querySelectorAll('.auth-method-section').forEach(section => {
|
|
1344
874
|
let active = section.classList.contains('auth-method-section-' + selected);
|
|
1345
875
|
section.classList.toggle('hidden', !active);
|
|
876
|
+
// a hidden section's required fields must not block the form, nor its values ride along
|
|
877
|
+
section.querySelectorAll('input, textarea').forEach(field => {
|
|
878
|
+
field.disabled = !active;
|
|
879
|
+
});
|
|
1346
880
|
});
|
|
1347
881
|
};
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
882
|
+
|
|
883
|
+
let selectedScope = () => {
|
|
884
|
+
let scopeElm = document.querySelector('.base-scopes-radio:checked');
|
|
885
|
+
return scopeElm && scopeElm.value;
|
|
886
|
+
};
|
|
887
|
+
|
|
888
|
+
authMethodRadios.forEach(radioElm => {
|
|
889
|
+
radioElm.addEventListener('change', () => {
|
|
890
|
+
showNotice('');
|
|
891
|
+
updateSections();
|
|
892
|
+
|
|
893
|
+
// The attached service account only works for a Pub/Sub app, so choosing it chooses
|
|
894
|
+
// that base scope too, and says so: the base scope card is above, likely out of view
|
|
895
|
+
if (radioElm.value === 'metadataServer' && pubsubScopeElm && selectedScope() !== 'pubsub') {
|
|
896
|
+
pubsubScopeElm.checked = true;
|
|
897
|
+
pubsubScopeElm.dispatchEvent(new Event('change', { bubbles: true }));
|
|
898
|
+
showNotice('The attached service account works only for Cloud Pub/Sub apps, so the base scope was set to Cloud Pub/Sub.');
|
|
1353
899
|
}
|
|
1354
|
-
let selected = tab.getAttribute('data-auth-method');
|
|
1355
|
-
authMethodTabs.forEach(other => {
|
|
1356
|
-
let isActive = other === tab;
|
|
1357
|
-
other.classList.toggle('tab-active', isActive);
|
|
1358
|
-
other.setAttribute('aria-selected', isActive ? 'true' : 'false');
|
|
1359
|
-
});
|
|
1360
|
-
authMethodInput.value = selected;
|
|
1361
|
-
updateSections(selected);
|
|
1362
900
|
});
|
|
1363
901
|
});
|
|
902
|
+
|
|
903
|
+
// Leaving Pub/Sub while the attached service account is selected falls back to the key, and
|
|
904
|
+
// says so, because the form must never submit a method the schema refuses for the scope
|
|
905
|
+
let checkScopedMethod = () => {
|
|
906
|
+
let scope = selectedScope();
|
|
907
|
+
if (!scope) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
let offered = scope === 'pubsub';
|
|
911
|
+
if (scopeBadgeElm) {
|
|
912
|
+
scopeBadgeElm.classList.toggle('hidden', offered);
|
|
913
|
+
}
|
|
914
|
+
if (!offered && selectedMethod() === 'metadataServer') {
|
|
915
|
+
document.getElementById('authMethodServiceKey').checked = true;
|
|
916
|
+
updateSections();
|
|
917
|
+
showNotice('The attached service account works only for Cloud Pub/Sub apps, so the method was switched to Service account key.');
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
document.querySelectorAll('.base-scopes-radio').forEach(radioElm => {
|
|
922
|
+
radioElm.addEventListener('change', checkScopedMethod);
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
checkScopedMethod();
|
|
926
|
+
// the rendered selection, so a re-rendered form disables the sections it hides from the start
|
|
927
|
+
updateSections();
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
let metadataProbeElm = document.getElementById('metadataProbe');
|
|
931
|
+
if (metadataProbeElm) {
|
|
932
|
+
let resultElm = document.getElementById('metadataProbeResult');
|
|
933
|
+
metadataProbeElm.addEventListener('click', e => {
|
|
934
|
+
e.preventDefault();
|
|
935
|
+
resultElm.textContent = 'Asking the metadata server...';
|
|
936
|
+
uiBusyAction(metadataProbeElm, () =>
|
|
937
|
+
uiPostJson('/admin/config/oauth/metadata-probe', {})
|
|
938
|
+
.then(data => {
|
|
939
|
+
if (!data || !data.success) {
|
|
940
|
+
resultElm.textContent = (data && data.error) || 'The metadata server could not be reached';
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
document.getElementById('googleProjectId').value = data.projectId || '';
|
|
944
|
+
resultElm.textContent = `Service account ${data.serviceAccountEmail}, project ${data.projectId}`;
|
|
945
|
+
})
|
|
946
|
+
.catch(err => {
|
|
947
|
+
resultElm.textContent = err.message;
|
|
948
|
+
})
|
|
949
|
+
);
|
|
950
|
+
});
|
|
1364
951
|
}
|
|
1365
952
|
|
|
1366
953
|
});
|