1

I need to know which user is connected with the organization via OAuth2.0 .I noticed in the xero developer site it contains some information but not clear enough. Is there anyone who is having python code written for this.

Reason : Currently I am getting all the organisation informations from the API connection.I need to filter the content of these output based on the user type who is connected(Ex: Manager).So for that I need to know which user(user email address) is connected with Oauth2.0

suresh_chinthy
  • 377
  • 2
  • 12

1 Answers1

2

To find out the email address of the authorizing user you need to ask for the openid profile email scopes during authorization. You will then receive an id token back (along with the access and refresh token) which you can decode to get the user's name and email address.

Any OpenID Connect library will allow you to do this.

Adam Moore
  • 371
  • 1
  • 5
  • Hi Do you have any sample code written for the way of decoding.Below is my way of introducing the scope,,,(Is that correct)scope = 'offline_access accounting.reports.read accounting.settings.read openid profile email' – suresh_chinthy Aug 24 '20 at 05:24
  • 1
    @suresh_chinthy - the following project should give you all the context you need in working with the id_token. https://github.com/XeroAPI/xero-python-oauth2-app - however your comment looks good in setting the openid scopes up correctly :) – SerKnight Aug 24 '20 at 16:04