({email, legacyGsuite, scopes, forcePicker = false})
| 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) { |
no test coverage detected