MCPcopy
hub / github.com/mailvelope/mailvelope / onAuthorize

Method onAuthorize

src/controller/gmail.controller.js:197–214  ·  view source on GitHub ↗
({email, legacyGsuite, scopes, forcePicker = false})

Source from the content-addressed store, hash-verified

195 }
196
197 async onAuthorize({email, legacyGsuite, scopes, forcePicker = false}) {
198 try {
199 const accessToken = await gmail.authorize(email, legacyGsuite, scopes, {forcePicker});
200 await this.checkLicense({email, legacyGsuite});
201 this.activateComponent();
202 if (this.authorizationRequest?.afterAuth) {
203 this.authorizationRequest.afterAuth();
204 }
205 this.authorizationRequest?.resolve(accessToken);
206 } catch (e) {
207 // Mismatch is recoverable via the in-modal retry, so keep the pending
208 // authorizationRequest open. Reject only on terminal errors.
209 if (e.code !== ERROR_GMAIL_ACCOUNT_MISMATCH) {
210 this.authorizationRequest?.reject(e);
211 }
212 throw e;
213 }
214 }
215
216 cancelAuthorization() {
217 if (this.authorizationRequest) {

Callers 2

authorizeGmailMethod · 0.80

Calls 4

checkLicenseMethod · 0.95
activateComponentMethod · 0.95
authorizeMethod · 0.80
rejectMethod · 0.80

Tested by

no test coverage detected