marketing-analytics/activation/sheets-based-installer/src/apps_script/pages/explicit_auth.html [119:157]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } /** * Redeems authorization code for OAuth refresh token. */ async function exchangeCode() { const clientId = document.getElementById('clientId').value; const clientSecret = document.getElementById('clientSecret').value; const urlWithCode = document.getElementById('urlWithCode').value; if (urlWithCode) { const code = urlWithCode.split('code=')[1].split('&')[0]; const parameters = { grant_type: 'authorization_code', redirect_uri: REDIRECT_URI, client_id: clientId, client_secret: clientSecret, code, }; const response = await fetch(`${OAUTH_BASE_URL}token`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', }, body: getQueryString(parameters), }); const token = await response.json(); const secret = { token, client_id: clientId, client_secret: clientSecret, }; const formattedJSON = JSON.stringify(secret, null, 2); document.getElementById('token').value = formattedJSON; } } /** * Enables the button. */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - marketing-analytics/activation/sheets-based-installer/src/apps_script/pages/oauth.html [97:135]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } /** * Redeems authorization code for OAuth refresh token. */ async function exchangeCode() { const clientId = document.getElementById('clientId').value; const clientSecret = document.getElementById('clientSecret').value; const urlWithCode = document.getElementById('urlWithCode').value; if (urlWithCode) { const code = urlWithCode.split('code=')[1].split('&')[0]; const parameters = { grant_type: 'authorization_code', redirect_uri: REDIRECT_URI, client_id: clientId, client_secret: clientSecret, code, }; const response = await fetch(`${OAUTH_BASE_URL}token`, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8', }, body: getQueryString(parameters), }); const token = await response.json(); const secret = { token, client_id: clientId, client_secret: clientSecret, }; const formattedJSON = JSON.stringify(secret, null, 2); document.getElementById('token').value = formattedJSON; } } /** * Enables the button. */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -