diff --git a/tes/apiendpoints.py b/tes/apiendpoints.py
index d46480aac8aa0eb43afada1ff9963767ffd75cbf..63aae935732f3730ff21b1d99bf3c076a736c82d 100644
--- a/tes/apiendpoints.py
+++ b/tes/apiendpoints.py
@@ -435,6 +435,7 @@ class AppUrl(Resource):
             inst = json.loads(request.args.get('appinst'))
             inst['twsproxy']='{twsproxy}'
             inst['twsproxyauth'] = request.cookies.get('twsproxyauth')
+            logger.debug('twsproxyauth {} {}'.format(inst['twsproxyauth'],request.cookies.get('twsproxyauth')))
             url = "{}/{}".format("{twsproxy}",appdef['client']['redir'].format(**inst))
             return url
         except Exception as e:
@@ -447,7 +448,7 @@ class AppUrl(Resource):
 class SetTWSProxyAuth(Resource):
     def get(self, authtok):
         import urllib.parse
-        url = urllib.parse.unquote(request.args.get(redirect))
+        url = urllib.parse.unquote(request.args.get('redirect'))
         response = make_response(redirect(url))
         response.set_cookie('twsproxyauth', authtok, secure=True)
         return response