Repository: auth0/auth0-python

Issue:
authentication.Users(client_domain).tokeninfo fails
I've got a traceback:


```python
In [78]: user_authentication.tokeninfo(id_token)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-78-decf4417ce18> in <module>()
----> 1 user_authentication.tokeninfo(id_token)
 
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/auth0/v2/authentication/users.pyc in tokeninfo(self, jwt)
     47             url='https://%s/tokeninfo' % self.domain,
￼
     48             data={'id_token': jwt},
---> 49             headers={'Content-Type: application/json'}
     50         )
 
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/auth0/v2/authentication/base.pyc in post(self, url, data, headers)
      8     def post(self, url, data={}, headers={}):
      9         response = requests.post(url=url, data=json.dumps(data),
---> 10                                  headers=headers)
     11         return self._process_response(response)
     12
 
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/requests/api.pyc in post(url, data, json, **kwargs)
    107     """
    108
--> 109     return request('post', url, data=data, json=json, **kwargs)
    110
    111
 
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/requests/api.pyc in request(method, url, **kwargs)
     48
     49     session = sessions.Session()
---> 50     response = session.request(method=method, url=url, **kwargs)
     51     # By explicitly closing the session, we avoid leaving sockets open which
     52     # can trigger a ResourceWarning in some cases, and look like a memory leak
 
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/requests/sessions.pyc in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, jso
n)
    452             hooks = hooks,
    453         )
--> 454         prep = self.prepare_request(req)
    455
    456         proxies = proxies or {}
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/requests/sessions.pyc in prepare_request(self, request)
    386             auth=merge_setting(auth, self.auth),
    387             cookies=merged_cookies,
--> 388             hooks=merge_hooks(request.hooks, self.hooks),
    389         )
    390         return p
 
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/requests/models.pyc in prepare(self, method, url, headers, files, data, params, auth, cookies, hooks, json)
    292         self.prepare_method(method)
    293         self.prepare_url(url, params)
--> 294         self.prepare_headers(headers)
    295         self.prepare_cookies(cookies)
    296         self.prepare_body(data, files, json)
 
/home/ale/.virtualenvs/auth0/lib/python2.7/site-packages/requests/models.pyc in prepare_headers(self, headers)
    400
    401         if headers:
--> 402             self.headers = CaseInsensitiveDict((to_native_string(name), value) for name, value in headers.items())
    403         else:
    404             self.headers = CaseInsensitiveDict()
 
AttributeError: 'set' object has no attribute 'items'
```

Comments:

Patch:
diff --git a/README.rst b/README.rst
index 0a16d58..d9cbd8a 100644
--- a/README.rst
+++ b/README.rst
@@ -54,10 +54,10 @@ To use the management library you will need to instantiate an Auth0 object with
     from auth0.v2.management import Auth0
 
     domain = 'myaccount.auth0.com'
-    token = '{A_JWT_TOKEN}' # You can generate one of these by using the
+    token = 'A_JWT_TOKEN' # You can generate one of these by using the
                             # token generator at: https://auth0.com/docs/api/v2
 
-    auth0 = Auth0('myuser.auth0.com', token)
+    auth0 = Auth0('myaccount.auth0.com', token)
 
 The ``Auth0()`` object is now ready to take orders!
 Let's see how we can use this to get all available connections.
diff --git a/auth0/v2/authentication/users.py b/auth0/v2/authentication/users.py
index e031a75..bec1b4d 100644
--- a/auth0/v2/authentication/users.py
+++ b/auth0/v2/authentication/users.py
@@ -46,5 +46,5 @@ class Users(AuthenticationBase):
         return self.post(
             url='https://%s/tokeninfo' % self.domain,
             data={'id_token': jwt},
-            headers={'Content-Type: application/json'}
+            headers={'Content-Type': 'application/json'}
         )
diff --git a/examples/flask-webapp/public/app.js b/examples/flask-webapp/public/app.js
index 16a837e..f36c6ab 100644
--- a/examples/flask-webapp/public/app.js
+++ b/examples/flask-webapp/public/app.js
@@ -1,10 +1,12 @@
 $(document).ready(function() {
-     var lock = new Auth0Lock(AUTH0_CLIENT_ID, AUTH0_DOMAIN  );
+     var lock = new Auth0Lock(AUTH0_CLIENT_ID, AUTH0_DOMAIN, {
+        auth: {
+          redirectUrl: AUTH0_CALLBACK_URL
+        }
+     });
 
     $('.btn-login').click(function(e) {
       e.preventDefault();
-      lock.show({
-        callbackURL: AUTH0_CALLBACK_URL
-    });
+      lock.show();
     });
 });
diff --git a/examples/flask-webapp/server.py b/examples/flask-webapp/server.py
index df54eb4..56cdc97 100644
--- a/examples/flask-webapp/server.py
+++ b/examples/flask-webapp/server.py
@@ -70,12 +70,5 @@ def callback_handling():
 
   return redirect('/dashboard')
 
-
-
-
-
-
-
-
 if __name__ == "__main__":
     app.run(host='0.0.0.0', port = int(os.environ.get('PORT', 3000)))
diff --git a/examples/flask-webapp/templates/home.html b/examples/flask-webapp/templates/home.html
index e6018ea..9bbf057 100644
--- a/examples/flask-webapp/templates/home.html
+++ b/examples/flask-webapp/templates/home.html
@@ -1,7 +1,7 @@
 <html>
     <head>
-        <script src="http://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
-        <script src="https://cdn.auth0.com/js/lock-9.0.js"></script>
+        <script src="http://code.jquery.com/jquery-3.1.0.min.js" type="text/javascript"></script>
+        <script src="https://cdn.auth0.com/js/lock/10.0/lock.min.js"></script>
 
         <script type="text/javascript" src="//use.typekit.net/iws6ohy.js"></script>
         <script type="text/javascript">try{Typekit.load();}catch(e){}</script>
@@ -9,8 +9,8 @@
         <meta name="viewport" content="width=device-width, initial-scale=1">
 
         <!-- font awesome from BootstrapCDN -->
-        <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
-        <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
+        <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
+        <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
 
         <script>
         var AUTH0_CLIENT_ID = '{{env.AUTH0_CLIENT_ID}}';


Test patch:
diff --git a/auth0/v2/test/authentication/test_users.py b/auth0/v2/test/authentication/test_users.py
index c842f55..446301d 100644
--- a/auth0/v2/test/authentication/test_users.py
+++ b/auth0/v2/test/authentication/test_users.py
@@ -27,5 +27,5 @@ class TestUsers(unittest.TestCase):
         mock_post.assert_called_with(
             url='https://my.domain.com/tokeninfo',
             data={'id_token': 'jwtoken'},
-            headers={'Content-Type: application/json'}
+            headers={'Content-Type': 'application/json'}
         )