summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleonoverweel <l.overweel@gmail.com>2017-04-01 21:36:22 +0200
committerleonoverweel <l.overweel@gmail.com>2017-04-01 21:36:22 +0200
commita06c408964dab6069b894c8fe11d09afdd7f9b81 (patch)
treed32c7c05bd02f40bc1f0146b76d2c32416baf4ee
parentbb4a12a0cf9c412c57879229226762f06c3390e7 (diff)
Replace web server test w/ auth token page
-rw-r--r--main.py2
-rw-r--r--static/index.html32
2 files changed, 5 insertions, 29 deletions
diff --git a/main.py b/main.py
index 1546a397..d49e4191 100644
--- a/main.py
+++ b/main.py
@@ -55,7 +55,7 @@ def serve_projects():
return send_from_directory(STATIC_ROOT, 'projects.html')
-@FLASK_CORE_APP.route('/web-server-test')
+@FLASK_CORE_APP.route('/my-auth-token')
def serve_web_server_test():
"""Serve the web server test."""
diff --git a/static/index.html b/static/index.html
index 744f7d27..3fc1c2d0 100644
--- a/static/index.html
+++ b/static/index.html
@@ -3,36 +3,9 @@
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/1.3.6/socket.io.min.js"></script>
<script>
function onSignIn(googleUser) {
- var id_token = googleUser.getAuthResponse().id_token;
-
- var socket = io.connect('http://' + document.domain + ':' + location.port);
- socket.on('connect', function() {
- socket.emit('request', {
- id: 234,
- path: "/v1/simulations/{simulationId}",
- method: "GET",
- parameters: {
- body: {
-
- },
- path: {
- simulationId: 1
- },
- query: {
- email:'l.overweel@gmail.com'
- }
- },
- token: id_token
- });
- })
-
- socket.on('response', function(response) {
- console.log(JSON.parse(response));
- });
+ document.getElementById('token').innerText = googleUser.getAuthResponse().id_token;
}
-
</script>
-
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
@@ -44,3 +17,6 @@ function onSignIn(googleUser) {
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<a href="#" onclick="signOut();">Sign out</a>
+
+<p>Your auth token:</p>
+<p id="token" style="word-wrap:break-word;">Loading...</p> \ No newline at end of file