Request data from /userinfo or /api/v2/users/ID

Hi,

I have a fully working setup with Auth0+Spring Boot+Angular running.
Now I am trying to get some more info from the logged in User in the Backend (Spring Boot).

First I am trying to get the Bearer-Token:
Url: https://xxx.xx.auth0.com/oauth/token
Header(“content-type”, “application/json”)
Body("{“client_id”:“XXXX”,“client_secret”:“XXXXXXX”,“audience”:“XXXXX”,“grant_type”:“client_credentials”}")
This is working and I am getting a long String seperated by dots as a Result (-> TOKEN).

I am using this String as a Bearer-Token for the next Request.
This could be either this Url: https://XXX.xx.auth0.com/userinfo
or that:https://XXX.xx.auth0.com/api/v2/users/ID
with the Header:
Header(“authorization”, "Bearer " + TOKEN)

Both Urls are resulting in unauthorized (Bad audience).

Can somebody please help me!

Best,
Peter

Hi @Stuzfuz,

Welcome to the Community!

You may be getting this error because the application does not have a client-grant set up with the Management API. To see if this is the issue, go to APIs in your Auth0 dashboard and select “Auth0 Management API” and click on the “Machine to Machine Applications” tab. You can see which application are authorized from there.

Let me know if that solves the issue!

Thanks,

Stephanie

1 Like

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