MCPcopy
hub / github.com/mailvelope/mailvelope / getAccessToken

Method getAccessToken

src/controller/gmail.controller.js:184–195  ·  view source on GitHub ↗

* Get access token * @param {String} email * @param {Array} scopes * @param {Function} beforeAuth - called before new authorization request is started * @param {Function} afterAuth - called after successful authorization request * @return {String}

({email, legacyGsuite, scopes = [gmail.GMAIL_SCOPE_READONLY, gmail.GMAIL_SCOPE_SEND], beforeAuth, afterAuth} = {})

Source from the content-addressed store, hash-verified

182 * @return {String}
183 */
184 async getAccessToken({email, legacyGsuite, scopes = [gmail.GMAIL_SCOPE_READONLY, gmail.GMAIL_SCOPE_SEND], beforeAuth, afterAuth} = {}) {
185 const accessToken = await this.checkAuthorization({email, scopes});
186 if (accessToken) {
187 await this.checkLicense({email, legacyGsuite});
188 return accessToken;
189 }
190 if (beforeAuth) {
191 beforeAuth();
192 }
193 this.openAuthorizeDialog({email, legacyGsuite, scopes});
194 return new Promise((resolve, reject) => this.authorizationRequest = {resolve, reject, afterAuth});
195 }
196
197 async onAuthorize({email, legacyGsuite, scopes, forcePicker = false}) {
198 try {

Callers 3

onSecureBtnMethod · 0.95
encryptedMessageMethod · 0.45
checkAuthorizationMethod · 0.45

Calls 3

checkAuthorizationMethod · 0.95
checkLicenseMethod · 0.95
openAuthorizeDialogMethod · 0.95

Tested by

no test coverage detected