MCPcopy Create free account
hub / github.com/mailvelope/mailvelope / getAuthTokens

Function getAuthTokens

src/modules/gmail.js:285–303  ·  view source on GitHub ↗
(authCode)

Source from the content-addressed store, hash-verified

283}
284
285async function getAuthTokens(authCode) {
286 const url = 'https://oauth2.googleapis.com/token';
287 const params = {
288 client_id: CLIENT_ID,
289 code: authCode,
290 client_secret: CLIENT_SECRET,
291 grant_type: 'authorization_code',
292 redirect_uri: chrome.identity.getRedirectURL()
293 };
294 const result = await fetch(url, {
295 method: 'POST',
296 body: new URLSearchParams(Object.entries(params)).toString(),
297 mode: 'cors',
298 headers: {
299 'Content-Type': 'application/x-www-form-urlencoded'
300 }
301 });
302 return result.json();
303}
304
305async function getRefreshedAccessToken(refresh_token) {
306 const url = 'https://oauth2.googleapis.com/token';

Callers 1

authorizeFunction · 0.85

Calls 1

fetchFunction · 0.85

Tested by

no test coverage detected