# Userinfo request

**URL:** <https://community.auth0.com/t/userinfo-request/55370>\
**Category:** Get Help\
**Tags:** python, userinfo, flask\
**Created:** [December 27, 2020, 1:42am UTC](https://community.auth0.com/t/userinfo-request/55370 "2020-12-27T01:42:06Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [December 27, 2020, 1:42am UTC](https://community.auth0.com/t/userinfo-request/55370/1 "2020-12-27T01:42:06Z")

</div>

Hi,  
I’m trialling Python flask app with Auth0 and it seems userinfo request only returns roles in the response. I have checked this using a Postman request and it returns the same. Could you please clarify why is that?

 ![image](https://global.discourse-cdn.com/auth0/original/3X/3/9/39bbc7778f0b052eec6f4d26968ada8b793112b2.png)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 29, 2020, 8:43pm UTC](https://community.auth0.com/t/userinfo-request/55370/3 "2020-12-29T20:43:30Z")

</div>

That is quite odd. Could you please send me the log of the request in a DM?

---

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [December 29, 2020, 11:19pm UTC](https://community.auth0.com/t/userinfo-request/55370/4 "2020-12-29T23:19:44Z")

</div>

Hi Dan,  
Unfortunately I’m using free plan because, I’m still trialling different integrations( ie .Net/Python etc ). It seems free plan doesn’t have logs.

Regards  
Chamila

---

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [December 29, 2020, 11:38pm UTC](https://community.auth0.com/t/userinfo-request/55370/5 "2020-12-29T23:38:08Z")

</div>

Actually I had a rule to return the roles. I have disabled it and now I get nothing in the response.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/1/c152cd080a1db3baaac51c586dc057217028458d.png)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 30, 2020, 8:01pm UTC](https://community.auth0.com/t/userinfo-request/55370/6 "2020-12-30T20:01:06Z")

</div>

@rchamila,

You should have access to logs, but they will only persist for a few days. They can be used to debug.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 30, 2020, 8:04pm UTC](https://community.auth0.com/t/userinfo-request/55370/8 "2020-12-30T20:04:49Z")

</div>

What scopes are you requesting for your access token?

---

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [January 1, 2021, 2:18am UTC](https://community.auth0.com/t/userinfo-request/55370/9 "2021-01-01T02:18:57Z")

</div>

Hello Dan,

Scopes are openid, profile and email

[https://dev-g4t6koig.au.auth0.com/authorize?response\_type=code&amp;client\_id=X9V0E9NHo7BZ1oGbtKsycsNsKFZv4zqu&amp;redirect\_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&amp;scope=openid%2520profile%2520email&amp;state=mruiM89rp8wZyanKbvejmQU00shl3D&amp;nonce=uB23LCNozsNljAIXvDoK](https://dev-g4t6koig.au.auth0.com/authorize?response_type=code&amp;client_id=X9V0E9NHo7BZ1oGbtKsycsNsKFZv4zqu&amp;redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&amp;scope=openid%2520profile%2520email&amp;state=mruiM89rp8wZyanKbvejmQU00shl3D&amp;nonce=uB23LCNozsNljAIXvDoK)

Also I can see the logs now

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/7/c77f09da260e02ca7f782107084bcc02bce11b57.png)

One log is attached[row.txt](https://community.auth0.com/uploads/short-url/dUZblzDZwhu4yvZa6BTcFVzqLvC.txt) (739 Bytes)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 4, 2021, 9:40pm UTC](https://community.auth0.com/t/userinfo-request/55370/10 "2021-01-04T21:40:34Z")

</div>

Can you try passing an _audience_ parameter so we can look at the token and confirm it has the correct scopes?

---

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [January 5, 2021, 12:05am UTC](https://community.auth0.com/t/userinfo-request/55370/12 "2021-01-05T00:05:56Z")

</div>

Thanks Dan for getting back to me. Unfortunately I couldn’t find how to set audience in Auth0 Flask library (authlib.integrations.flask\_client ). This is how it sets. Can you please assist me to set the audience parameter here.

oauth = OAuth(app)

auth0 = oauth.register(  
‘auth0’,  
client\_id=AUTH0\_CLIENT\_ID,  
client\_secret=AUTH0\_CLIENT\_SECRET,  
api\_base\_url=AUTH0\_BASE\_URL,  
access\_token\_url=AUTH0\_BASE\_URL + ‘/oauth/token’,  
authorize\_url=AUTH0\_BASE\_URL + ‘/authorize’,  
client\_kwargs={  
‘scope’: ‘openid%20profile%20email’,  
}  
)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 5, 2021, 12:10am UTC](https://community.auth0.com/t/userinfo-request/55370/13 "2021-01-05T00:10:56Z")

</div>

You should be able to add it there.

`audience=AUTH0_BASE_URL + '/api/v2'`

You will also need to go to your dashboard, API → Auth0 Management API → Machine to Machine Applications, then authorize your flask app.

---

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [January 5, 2021, 12:27am UTC](https://community.auth0.com/t/userinfo-request/55370/14 "2021-01-05T00:27:55Z")

</div>

This is the auth response after adding audience. Hope this is what you want. Thanks

c8lCuUG8HHH2wAs4hLE7sI9iOXC8WJHc

 ![image](https://global.discourse-cdn.com/auth0/original/3X/3/2/3283e03be2ac37042a4b4d4c86e098c1f7196fe8.jpeg)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 5, 2021, 12:32am UTC](https://community.auth0.com/t/userinfo-request/55370/15 "2021-01-05T00:32:13Z")

</div>

Hmm, it doesn’t look like a jwt. This makes me think the audience wasn’t set properly.

---

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [January 5, 2021, 12:47am UTC](https://community.auth0.com/t/userinfo-request/55370/16 "2021-01-05T00:47:04Z")

</div>

Bit of additional details below, not sure whether this will help you or not

Response:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/7/5/75ce88f42aa554e313a4d7c49cb5491d88f6c05c.jpeg)

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 5, 2021, 8:22pm UTC](https://community.auth0.com/t/userinfo-request/55370/17 "2021-01-05T20:22:58Z")

</div>

From the documentation for that library, it looks like you can send extra params with:

- `{name}_AUTHORIZE_PARAMS` : Extra parameters for Authorization Endpoint.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 5, 2021, 8:26pm UTC](https://community.auth0.com/t/userinfo-request/55370/18 "2021-01-05T20:26:12Z")

</div>

You will also want to rotate your client secret as it was listed here in plain text. I edited out for you.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 5, 2021, 8:36pm UTC](https://community.auth0.com/t/userinfo-request/55370/19 "2021-01-05T20:36:12Z")

</div>

It looks like you are passing the scope incorrectly. It doesn’t look like it needs to be URL encoded.

---

<div class="post-metadata">

**Author:** ![rchamila](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rchamila/32/14363_2.png) [@rchamila](https://community.auth0.com/u/rchamila)\
**Post date:** [January 6, 2021, 2:50pm UTC](https://community.auth0.com/t/userinfo-request/55370/20 "2021-01-06T14:50:09Z")

</div>

Whooo, hoo. Yeah that’s the reason, removing url encoding fix the issue. Thanks a lot Dan. Cheers!!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 6, 2021, 4:38pm UTC](https://community.auth0.com/t/userinfo-request/55370/21 "2021-01-06T16:38:39Z")

</div>

Glad that solved it!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 21, 2021, 4:38pm UTC](https://community.auth0.com/t/userinfo-request/55370/22 "2021-01-21T16:38:47Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
