imap-backup 3.4.0 → 4.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +2 -2
- data/.rubocop_todo.yml +1 -1
- data/CHANGELOG.md +19 -0
- data/README.md +22 -8
- data/bin/imap-backup +3 -93
- data/imap-backup +9 -0
- data/imap-backup.gemspec +2 -3
- data/lib/email/mboxrd/message.rb +2 -2
- data/lib/imap/backup/account/connection.rb +16 -33
- data/lib/imap/backup/cli/backup.rb +21 -0
- data/lib/imap/backup/cli/folders.rb +27 -0
- data/lib/imap/backup/cli/helpers.rb +20 -0
- data/lib/imap/backup/cli/local.rb +70 -0
- data/lib/imap/backup/cli/restore.rb +19 -0
- data/lib/imap/backup/cli/setup.rb +13 -0
- data/lib/imap/backup/cli/status.rb +26 -0
- data/lib/imap/backup/cli.rb +89 -0
- data/lib/imap/backup/configuration/account.rb +1 -11
- data/lib/imap/backup/configuration/list.rb +13 -12
- data/lib/imap/backup/version.rb +3 -3
- data/lib/imap/backup.rb +0 -1
- data/spec/unit/imap/backup/account/connection_spec.rb +31 -51
- data/spec/unit/imap/backup/configuration/account_spec.rb +0 -43
- data/spec/unit/imap/backup/configuration/list_spec.rb +1 -0
- metadata +23 -62
- data/docs/01-credentials-screen.png +0 -0
- data/docs/02-new-project.png +0 -0
- data/docs/03-initial-credentials-for-project.png +0 -0
- data/docs/04-credential-type-selection.png +0 -0
- data/docs/05-cant-create-without-consent-setup.png +0 -0
- data/docs/06-user-type-selection.png +0 -0
- data/docs/07-consent-screen-form.png +0 -0
- data/docs/08-app-scopes.png +0 -0
- data/docs/09-scope-selection.png +0 -0
- data/docs/10-updated-app-scopes.png +0 -0
- data/docs/11-test-users.png +0 -0
- data/docs/12-add-users.png +0 -0
- data/docs/13-create-oauth-client.png +0 -0
- data/docs/14-application-details.png +0 -0
- data/docs/16-initial-menu.png +0 -0
- data/docs/17-inputting-the-email-address.png +0 -0
- data/docs/18-choose-password.png +0 -0
- data/docs/19-supply-client-info.png +0 -0
- data/docs/20-choose-gmail-account.png +0 -0
- data/docs/21-accept-warnings.png +0 -0
- data/docs/22-grant-access.png +0 -0
- data/docs/24-confirm-choices.png +0 -0
- data/docs/25-success-code.png +0 -0
- data/docs/26-type-code-into-imap-backup.png +0 -0
- data/docs/27-success.png +0 -0
- data/docs/setting-up-gmail-with-oauth2.md +0 -166
- data/lib/gmail/authenticator.rb +0 -160
- data/lib/google/auth/stores/in_memory_token_store.rb +0 -9
- data/lib/imap/backup/configuration/gmail_oauth2.rb +0 -102
- data/spec/unit/gmail/authenticator_spec.rb +0 -138
- data/spec/unit/google/auth/stores/in_memory_token_store_spec.rb +0 -15
- data/spec/unit/imap/backup/configuration/gmail_oauth2_spec.rb +0 -121
@@ -4,7 +4,7 @@ module Imap::Backup
|
|
4
4
|
class Configuration::List
|
5
5
|
attr_reader :required_accounts
|
6
6
|
|
7
|
-
def initialize(required_accounts =
|
7
|
+
def initialize(required_accounts = [])
|
8
8
|
@required_accounts = required_accounts
|
9
9
|
end
|
10
10
|
|
@@ -12,6 +12,7 @@ module Imap::Backup
|
|
12
12
|
return if !config_exists?
|
13
13
|
|
14
14
|
Imap::Backup.setup_logging config
|
15
|
+
Net::IMAP.debug = config.debug?
|
15
16
|
end
|
16
17
|
|
17
18
|
def each_connection
|
@@ -22,6 +23,17 @@ module Imap::Backup
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
def accounts
|
27
|
+
@accounts ||=
|
28
|
+
if required_accounts.empty?
|
29
|
+
config.accounts
|
30
|
+
else
|
31
|
+
config.accounts.select do |account|
|
32
|
+
required_accounts.include?(account[:username])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
25
37
|
private
|
26
38
|
|
27
39
|
def config
|
@@ -37,16 +49,5 @@ module Imap::Backup
|
|
37
49
|
def config_exists?
|
38
50
|
Configuration::Store.exist?
|
39
51
|
end
|
40
|
-
|
41
|
-
def accounts
|
42
|
-
@accounts ||=
|
43
|
-
if required_accounts.nil?
|
44
|
-
config.accounts
|
45
|
-
else
|
46
|
-
config.accounts.select do |account|
|
47
|
-
required_accounts.include?(account[:username])
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
52
|
end
|
52
53
|
end
|
data/lib/imap/backup/version.rb
CHANGED
data/lib/imap/backup.rb
CHANGED
@@ -7,7 +7,6 @@ require "imap/backup/configuration/account"
|
|
7
7
|
require "imap/backup/configuration/asker"
|
8
8
|
require "imap/backup/configuration/connection_tester"
|
9
9
|
require "imap/backup/configuration/folder_chooser"
|
10
|
-
require "imap/backup/configuration/gmail_oauth2"
|
11
10
|
require "imap/backup/configuration/list"
|
12
11
|
require "imap/backup/configuration/setup"
|
13
12
|
require "imap/backup/configuration/store"
|
@@ -90,56 +90,11 @@ describe Imap::Backup::Account::Connection do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
context "with the GMail IMAP server" do
|
93
|
-
ACCESS_TOKEN = "access_token".freeze
|
94
|
-
|
95
93
|
let(:server) { GMAIL_IMAP_SERVER }
|
96
94
|
let(:refresh_token) { true }
|
97
95
|
let(:result) { nil }
|
98
|
-
let(:authenticator) do
|
99
|
-
instance_double(
|
100
|
-
Gmail::Authenticator,
|
101
|
-
credentials: credentials
|
102
|
-
)
|
103
|
-
end
|
104
|
-
let(:credentials) { OpenStruct.new(access_token: ACCESS_TOKEN) }
|
105
|
-
|
106
|
-
before do
|
107
|
-
allow(Gmail::Authenticator).
|
108
|
-
to receive(:refresh_token?) { refresh_token }
|
109
|
-
allow(Gmail::Authenticator).
|
110
|
-
to receive(:new).
|
111
|
-
with(email: USERNAME, token: PASSWORD) { authenticator }
|
112
|
-
end
|
113
|
-
|
114
|
-
context "when the password is our copy of a GMail refresh token and the environment IMAP_BACKUP_ENABLE_GMAIL_OAUTH2 is set" do
|
115
|
-
before do
|
116
|
-
ENV["IMAP_BACKUP_ENABLE_GMAIL_OAUTH2"] = "1"
|
117
|
-
end
|
118
|
-
|
119
|
-
after do
|
120
|
-
ENV.delete("IMAP_BACKUP_ENABLE_GMAIL_OAUTH2")
|
121
|
-
end
|
122
|
-
|
123
|
-
it "uses the OAuth2 access_token to authenticate" do
|
124
|
-
subject.imap
|
125
|
-
|
126
|
-
expect(imap).to have_received(:authenticate).with(
|
127
|
-
"XOAUTH2", USERNAME, ACCESS_TOKEN
|
128
|
-
)
|
129
|
-
end
|
130
|
-
|
131
|
-
context "when the refresh token is invalid" do
|
132
|
-
let(:credentials) { nil }
|
133
|
-
|
134
|
-
it "raises" do
|
135
|
-
expect { subject.imap }.to raise_error(String)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
end
|
139
96
|
|
140
97
|
context "when the password is not our copy of a GMail refresh token" do
|
141
|
-
let(:refresh_token) { false }
|
142
|
-
|
143
98
|
it "uses the password" do
|
144
99
|
subject.imap
|
145
100
|
|
@@ -433,24 +388,49 @@ describe Imap::Backup::Account::Connection do
|
|
433
388
|
end
|
434
389
|
|
435
390
|
describe "#reconnect" do
|
436
|
-
|
437
|
-
|
391
|
+
context "when the IMAP connection has been used" do
|
392
|
+
before { subject.imap }
|
438
393
|
|
439
|
-
|
394
|
+
it "disconnects from the server" do
|
395
|
+
expect(imap).to receive(:disconnect)
|
396
|
+
|
397
|
+
subject.reconnect
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
context "when the IMAP connection has not been used" do
|
402
|
+
it "does not disconnect from the server" do
|
403
|
+
expect(imap).to_not receive(:disconnect)
|
404
|
+
|
405
|
+
subject.reconnect
|
406
|
+
end
|
440
407
|
end
|
441
408
|
|
442
409
|
it "causes reconnection on future access" do
|
443
410
|
expect(Net::IMAP).to receive(:new)
|
444
411
|
|
445
412
|
subject.reconnect
|
413
|
+
subject.imap
|
446
414
|
end
|
447
415
|
end
|
448
416
|
|
449
417
|
describe "#disconnect" do
|
450
|
-
|
451
|
-
|
418
|
+
context "when the IMAP connection has been used" do
|
419
|
+
it "disconnects from the server" do
|
420
|
+
subject.imap
|
421
|
+
|
422
|
+
expect(imap).to receive(:disconnect)
|
423
|
+
|
424
|
+
subject.disconnect
|
425
|
+
end
|
426
|
+
end
|
452
427
|
|
453
|
-
|
428
|
+
context "when the IMAP connection has not been used" do
|
429
|
+
it "does not disconnect from the server" do
|
430
|
+
expect(imap).to_not receive(:disconnect)
|
431
|
+
|
432
|
+
subject.disconnect
|
433
|
+
end
|
454
434
|
end
|
455
435
|
end
|
456
436
|
end
|
@@ -241,49 +241,6 @@ describe Imap::Backup::Configuration::Account do
|
|
241
241
|
end
|
242
242
|
end
|
243
243
|
|
244
|
-
describe "choosing 'modify password' when the server is for GMail" do
|
245
|
-
let(:new_password) { "new_password" }
|
246
|
-
let(:current_server) { GMAIL_IMAP_SERVER }
|
247
|
-
let(:gmail_oauth2) do
|
248
|
-
instance_double(Imap::Backup::Configuration::GmailOauth2, run: nil)
|
249
|
-
end
|
250
|
-
|
251
|
-
before do
|
252
|
-
allow(Imap::Backup::Configuration::Asker).
|
253
|
-
to receive(:password) { new_password }
|
254
|
-
allow(Imap::Backup::Configuration::GmailOauth2).
|
255
|
-
to receive(:new).
|
256
|
-
with(account) { gmail_oauth2 }
|
257
|
-
end
|
258
|
-
|
259
|
-
context "when the environment IMAP_BACKUP_ENABLE_GMAIL_OAUTH2 is set" do
|
260
|
-
before do
|
261
|
-
ENV["IMAP_BACKUP_ENABLE_GMAIL_OAUTH2"] = "1"
|
262
|
-
subject.run
|
263
|
-
menu.choices["modify password"].call
|
264
|
-
end
|
265
|
-
|
266
|
-
after do
|
267
|
-
ENV.delete("IMAP_BACKUP_ENABLE_GMAIL_OAUTH2")
|
268
|
-
end
|
269
|
-
|
270
|
-
it "sets up GMail OAuth2" do
|
271
|
-
expect(gmail_oauth2).to have_received(:run)
|
272
|
-
end
|
273
|
-
end
|
274
|
-
|
275
|
-
context "when the environment IMAP_BACKUP_ENABLE_GMAIL_OAUTH2 is not set" do
|
276
|
-
before do
|
277
|
-
subject.run
|
278
|
-
menu.choices["modify password"].call
|
279
|
-
end
|
280
|
-
|
281
|
-
it "sets up GMail OAuth2" do
|
282
|
-
expect(gmail_oauth2).to_not have_received(:run)
|
283
|
-
end
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
244
|
describe "choosing 'modify server'" do
|
288
245
|
let(:server) { "server" }
|
289
246
|
|
@@ -35,6 +35,7 @@ describe Imap::Backup::Configuration::List do
|
|
35
35
|
allow(Imap::Backup::Configuration::Store).
|
36
36
|
to receive(:exist?) { config_exists }
|
37
37
|
allow(Imap::Backup).to receive(:setup_logging)
|
38
|
+
allow(store).to receive(:debug?)
|
38
39
|
end
|
39
40
|
|
40
41
|
it "sets global logging level" do
|
metadata
CHANGED
@@ -1,31 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imap-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.rc3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Yates
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: googleauth
|
14
|
+
name: highline
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
@@ -39,7 +25,7 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: mail
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ">="
|
@@ -53,7 +39,7 @@ dependencies:
|
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
42
|
+
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
45
|
- - ">="
|
@@ -67,19 +53,19 @@ dependencies:
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
56
|
+
name: thor
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '1.1'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '1.1'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: codeclimate-test-reporter
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,52 +164,33 @@ files:
|
|
178
164
|
- ".rspec-all"
|
179
165
|
- ".rubocop.yml"
|
180
166
|
- ".rubocop_todo.yml"
|
167
|
+
- CHANGELOG.md
|
181
168
|
- Gemfile
|
182
169
|
- LICENSE
|
183
170
|
- README.md
|
184
171
|
- Rakefile
|
185
172
|
- bin/imap-backup
|
186
173
|
- docker-compose.yml
|
187
|
-
- docs/01-credentials-screen.png
|
188
|
-
- docs/02-new-project.png
|
189
|
-
- docs/03-initial-credentials-for-project.png
|
190
|
-
- docs/04-credential-type-selection.png
|
191
|
-
- docs/05-cant-create-without-consent-setup.png
|
192
|
-
- docs/06-user-type-selection.png
|
193
|
-
- docs/07-consent-screen-form.png
|
194
|
-
- docs/08-app-scopes.png
|
195
|
-
- docs/09-scope-selection.png
|
196
|
-
- docs/10-updated-app-scopes.png
|
197
|
-
- docs/11-test-users.png
|
198
|
-
- docs/12-add-users.png
|
199
|
-
- docs/13-create-oauth-client.png
|
200
|
-
- docs/14-application-details.png
|
201
|
-
- docs/16-initial-menu.png
|
202
|
-
- docs/17-inputting-the-email-address.png
|
203
|
-
- docs/18-choose-password.png
|
204
|
-
- docs/19-supply-client-info.png
|
205
|
-
- docs/20-choose-gmail-account.png
|
206
|
-
- docs/21-accept-warnings.png
|
207
|
-
- docs/22-grant-access.png
|
208
|
-
- docs/24-confirm-choices.png
|
209
|
-
- docs/25-success-code.png
|
210
|
-
- docs/26-type-code-into-imap-backup.png
|
211
|
-
- docs/27-success.png
|
212
174
|
- docs/docker-imap.md
|
213
|
-
-
|
175
|
+
- imap-backup
|
214
176
|
- imap-backup.gemspec
|
215
177
|
- lib/email/mboxrd/message.rb
|
216
178
|
- lib/email/provider.rb
|
217
|
-
- lib/gmail/authenticator.rb
|
218
|
-
- lib/google/auth/stores/in_memory_token_store.rb
|
219
179
|
- lib/imap/backup.rb
|
220
180
|
- lib/imap/backup/account/connection.rb
|
221
181
|
- lib/imap/backup/account/folder.rb
|
182
|
+
- lib/imap/backup/cli.rb
|
183
|
+
- lib/imap/backup/cli/backup.rb
|
184
|
+
- lib/imap/backup/cli/folders.rb
|
185
|
+
- lib/imap/backup/cli/helpers.rb
|
186
|
+
- lib/imap/backup/cli/local.rb
|
187
|
+
- lib/imap/backup/cli/restore.rb
|
188
|
+
- lib/imap/backup/cli/setup.rb
|
189
|
+
- lib/imap/backup/cli/status.rb
|
222
190
|
- lib/imap/backup/configuration/account.rb
|
223
191
|
- lib/imap/backup/configuration/asker.rb
|
224
192
|
- lib/imap/backup/configuration/connection_tester.rb
|
225
193
|
- lib/imap/backup/configuration/folder_chooser.rb
|
226
|
-
- lib/imap/backup/configuration/gmail_oauth2.rb
|
227
194
|
- lib/imap/backup/configuration/list.rb
|
228
195
|
- lib/imap/backup/configuration/setup.rb
|
229
196
|
- lib/imap/backup/configuration/store.rb
|
@@ -252,15 +219,12 @@ files:
|
|
252
219
|
- spec/support/silence_logging.rb
|
253
220
|
- spec/unit/email/mboxrd/message_spec.rb
|
254
221
|
- spec/unit/email/provider_spec.rb
|
255
|
-
- spec/unit/gmail/authenticator_spec.rb
|
256
|
-
- spec/unit/google/auth/stores/in_memory_token_store_spec.rb
|
257
222
|
- spec/unit/imap/backup/account/connection_spec.rb
|
258
223
|
- spec/unit/imap/backup/account/folder_spec.rb
|
259
224
|
- spec/unit/imap/backup/configuration/account_spec.rb
|
260
225
|
- spec/unit/imap/backup/configuration/asker_spec.rb
|
261
226
|
- spec/unit/imap/backup/configuration/connection_tester_spec.rb
|
262
227
|
- spec/unit/imap/backup/configuration/folder_chooser_spec.rb
|
263
|
-
- spec/unit/imap/backup/configuration/gmail_oauth2_spec.rb
|
264
228
|
- spec/unit/imap/backup/configuration/list_spec.rb
|
265
229
|
- spec/unit/imap/backup/configuration/setup_spec.rb
|
266
230
|
- spec/unit/imap/backup/configuration/store_spec.rb
|
@@ -283,12 +247,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
283
247
|
requirements:
|
284
248
|
- - ">="
|
285
249
|
- !ruby/object:Gem::Version
|
286
|
-
version: 2.
|
250
|
+
version: '2.5'
|
287
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
288
252
|
requirements:
|
289
|
-
- - "
|
253
|
+
- - ">"
|
290
254
|
- !ruby/object:Gem::Version
|
291
|
-
version:
|
255
|
+
version: 1.3.1
|
292
256
|
requirements: []
|
293
257
|
rubygems_version: 3.1.4
|
294
258
|
signing_key:
|
@@ -311,15 +275,12 @@ test_files:
|
|
311
275
|
- spec/support/silence_logging.rb
|
312
276
|
- spec/unit/email/mboxrd/message_spec.rb
|
313
277
|
- spec/unit/email/provider_spec.rb
|
314
|
-
- spec/unit/gmail/authenticator_spec.rb
|
315
|
-
- spec/unit/google/auth/stores/in_memory_token_store_spec.rb
|
316
278
|
- spec/unit/imap/backup/account/connection_spec.rb
|
317
279
|
- spec/unit/imap/backup/account/folder_spec.rb
|
318
280
|
- spec/unit/imap/backup/configuration/account_spec.rb
|
319
281
|
- spec/unit/imap/backup/configuration/asker_spec.rb
|
320
282
|
- spec/unit/imap/backup/configuration/connection_tester_spec.rb
|
321
283
|
- spec/unit/imap/backup/configuration/folder_chooser_spec.rb
|
322
|
-
- spec/unit/imap/backup/configuration/gmail_oauth2_spec.rb
|
323
284
|
- spec/unit/imap/backup/configuration/list_spec.rb
|
324
285
|
- spec/unit/imap/backup/configuration/setup_spec.rb
|
325
286
|
- spec/unit/imap/backup/configuration/store_spec.rb
|
Binary file
|
data/docs/02-new-project.png
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/docs/08-app-scopes.png
DELETED
Binary file
|
data/docs/09-scope-selection.png
DELETED
Binary file
|
Binary file
|
data/docs/11-test-users.png
DELETED
Binary file
|
data/docs/12-add-users.png
DELETED
Binary file
|
Binary file
|
Binary file
|
data/docs/16-initial-menu.png
DELETED
Binary file
|
Binary file
|
data/docs/18-choose-password.png
DELETED
Binary file
|
Binary file
|
Binary file
|
data/docs/21-accept-warnings.png
DELETED
Binary file
|
data/docs/22-grant-access.png
DELETED
Binary file
|
data/docs/24-confirm-choices.png
DELETED
Binary file
|
data/docs/25-success-code.png
DELETED
Binary file
|
Binary file
|
data/docs/27-success.png
DELETED
Binary file
|
@@ -1,166 +0,0 @@
|
|
1
|
-
# Setting up GMail Authentication for imap-backup
|
2
|
-
|
3
|
-
# Create a Google project
|
4
|
-
|
5
|
-
Go to https://console.developers.google.com
|
6
|
-
|
7
|
-
Select "Credentials".
|
8
|
-
|
9
|
-
![Credential screen](01-credentials-screen.png)
|
10
|
-
|
11
|
-
Select "CREATE PROJECT".
|
12
|
-
|
13
|
-
![New project](02-new-project.png)
|
14
|
-
|
15
|
-
Set or accept the "Project name",
|
16
|
-
|
17
|
-
And optionally do the same with the "Project ID",
|
18
|
-
|
19
|
-
Leave "Location" on "No organization",
|
20
|
-
|
21
|
-
Click "CREATE".
|
22
|
-
|
23
|
-
![Initial project credentials](03-initial-credentials-for-project.png)
|
24
|
-
|
25
|
-
Click "+ CREATE CREDENTIALS".
|
26
|
-
|
27
|
-
![Credential type selection](04-credential-type-selection.png)
|
28
|
-
|
29
|
-
Select "OAuth client ID".
|
30
|
-
|
31
|
-
![Can't create credentials before setting up the consent screen](05-cant-create-without-consent-setup.png)
|
32
|
-
|
33
|
-
Click "CONFIGURE CONSENT SCREEN".
|
34
|
-
|
35
|
-
![User type selection](06-user-type-selection.png)
|
36
|
-
|
37
|
-
Select "External",
|
38
|
-
|
39
|
-
Click "CREATE".
|
40
|
-
|
41
|
-
![Consent screen form](07-consent-screen-form.png)
|
42
|
-
|
43
|
-
Fill in "App name",
|
44
|
-
|
45
|
-
Select your email as "User support email",
|
46
|
-
|
47
|
-
Type in your email at the bottom under "Developer contact information",
|
48
|
-
|
49
|
-
Click "SAVE AND CONTINUE".
|
50
|
-
|
51
|
-
![App scopes](08-app-scopes.png)
|
52
|
-
|
53
|
-
Click "ADD OR REMOVE SCOPES".
|
54
|
-
|
55
|
-
![Scope selection](09-scope-selection.png)
|
56
|
-
|
57
|
-
Under "Manually add scopes", type "https://mail.google.com/",
|
58
|
-
|
59
|
-
Click "ADD TO TABLE",
|
60
|
-
|
61
|
-
Click "UPDATE".
|
62
|
-
|
63
|
-
![Updated app scopes](10-updated-app-scopes.png)
|
64
|
-
|
65
|
-
Click "SAVE AND CONTINUE".
|
66
|
-
|
67
|
-
![Test users](11-test-users.png)
|
68
|
-
|
69
|
-
Click "+ ADD USERS".
|
70
|
-
|
71
|
-
![Add users](12-add-users.png)
|
72
|
-
|
73
|
-
Type in your email,
|
74
|
-
|
75
|
-
Click "SAVE AND CONTINUE",
|
76
|
-
|
77
|
-
Click "BACK TO DASHBOARD",
|
78
|
-
|
79
|
-
Click "Credentials" in the menu
|
80
|
-
|
81
|
-
And then click "+ CREATE CREDENTIALS" again,
|
82
|
-
|
83
|
-
And select "OAuth client ID" again.
|
84
|
-
|
85
|
-
![Create OAuth client](13-create-oauth-client.png)
|
86
|
-
|
87
|
-
This time you will be able to proceed.
|
88
|
-
|
89
|
-
![Application details](14-application-details.png)
|
90
|
-
|
91
|
-
Select "TVs and limited input devices",
|
92
|
-
|
93
|
-
Click "CREATE",
|
94
|
-
|
95
|
-
Copy both "Your Client ID"
|
96
|
-
|
97
|
-
And "Your Client Secret".
|
98
|
-
|
99
|
-
# Set up imap-backup
|
100
|
-
|
101
|
-
Run `imap-backup setup`.
|
102
|
-
|
103
|
-
![Initial imap-backup menu](16-initial-menu.png)
|
104
|
-
|
105
|
-
Choose 'add account'.
|
106
|
-
|
107
|
-
![Type in your email address](17-inputting-the-email-address.png)
|
108
|
-
|
109
|
-
Type in your GMail address.
|
110
|
-
|
111
|
-
Note: if you have a custom domain (GSuite) address,
|
112
|
-
e.g. "me@mycompany.com", you now need to
|
113
|
-
choose 'server' and
|
114
|
-
type in 'imap.gmail.com'.
|
115
|
-
|
116
|
-
![Choose password](18-choose-password.png)
|
117
|
-
|
118
|
-
Choose `password`.
|
119
|
-
|
120
|
-
![Supply client info](19-supply-client-info.png)
|
121
|
-
|
122
|
-
Type your "Client ID" and "Client Secret",
|
123
|
-
|
124
|
-
Next you will be shown a URL to open in your browser.
|
125
|
-
|
126
|
-
![Choose GMail account](20-choose-gmail-account.png)
|
127
|
-
|
128
|
-
If you have more than one GMail account you will need to choose which
|
129
|
-
you are configuring.
|
130
|
-
|
131
|
-
![Accept warnings](21-accept-warnings.png)
|
132
|
-
|
133
|
-
As the project "app" is in test mode,
|
134
|
-
you'll need to accept to ignore this warning.
|
135
|
-
|
136
|
-
Click "Advanced",
|
137
|
-
|
138
|
-
Then click "Go to XXXYYYZZZ (unsafe)"
|
139
|
-
|
140
|
-
![Grant access](22-grant-access.png)
|
141
|
-
|
142
|
-
Choose "Allow".
|
143
|
-
|
144
|
-
![Confirm choices](24-confirm-choices.png)
|
145
|
-
|
146
|
-
Choose "Allow".
|
147
|
-
|
148
|
-
![Success code screen](25-success-code.png)
|
149
|
-
|
150
|
-
Click on the copy logo to copy the success code.
|
151
|
-
|
152
|
-
![Paste the code](26-type-code-into-imap_backup.png)
|
153
|
-
|
154
|
-
Paste the success code into imap-backup.
|
155
|
-
|
156
|
-
Finally, choose 'test connection'.
|
157
|
-
|
158
|
-
If all has gone well you should see this:
|
159
|
-
|
160
|
-
![Connection successful](27-success.png)
|
161
|
-
|
162
|
-
Now choose 'return to main menu',
|
163
|
-
|
164
|
-
Then 'save and exit'.
|
165
|
-
|
166
|
-
Your imap-backup is now configured to back up your GMail.
|