diff --git a/static/js-src/cs-client.js b/static/js-src/cs-client.js index 1259bc09..70073267 100644 --- a/static/js-src/cs-client.js +++ b/static/js-src/cs-client.js @@ -92,7 +92,7 @@ class ChromeStatusClient { if (response.status !== 200) { throw new Error( - `Got error response from server: ${response.status}`); + `Got error response from server ${resource}: ${response.status}`); } const rawResponseText = await response.text(); const XSSIPrefix = ')]}\'\n'; @@ -131,6 +131,22 @@ class ChromeStatusClient { // ////////////////////////////////////////////////////////////// // Specific API calls + // Signing in and out + + signIn(googleUser) { + // TODO(jrobbins): Consider using profile pic. + // let profile = googleUser.getBasicProfile(); + let idToken = googleUser.getAuthResponse().id_token; + // We don't use doPost because we don't already have a XSRF token. + return this.doFetch('/login', 'POST', {'id_token': idToken}, false); + } + + signOut(auth2) { + return auth2.signOut().then(() => { + return this.doPost('/logout'); + }); + } + // Cues API dismissCue(cue) { diff --git a/templates/_base.html b/templates/_base.html index 813acfd0..c7736323 100644 --- a/templates/_base.html +++ b/templates/_base.html @@ -65,45 +65,25 @@ limitations under the License. +{% endif %}