!7
html {
// needed for initiation and callback
S redirect_uri = fullRawLink("/callback");
if (eq(uri, "/callback")) {
S code = assertNempty(params.get("code"));
Map tokenMap = googleAuthorizationCodeToTokens_raw(googleBotCompanyClientID(), googleBotCompanyClientSecret(), redirect_uri, code);
printStruct(+tokenMap);
// Tokens will be in "access_token" and "refresh_token"
ret printAndProgramLog("We're back from Google! " + hpre(pnlToString(params) + "\n" + pnlToString(tokenMap)));
}
S client_id = googleBotCompanyClientID();
S scope = "https://www.googleapis.com/auth/calendar";
ret hrefresh(2.0, print(googleOAuthRedirectURL(print(+redirect_uri), client_id, scope))) + "Redirecting to Google...";
}