Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Xero-user-id returned in Oauth2 flow can not be used to find user in Xero.

Started by Sam Kidman -   in API Authentication

We use the OAuth2 flow to allow users of our system to connect to their Xero organisation and integrate.

We noticed that if the (Xero) user who performs the OAuth2 is later removed from the Xero organisation, the OAuth2 token can no longer be used.

We thought we could use the xero-user-id returned by the OAuth2 flow to find the user in Xero, and potentially provide more information on our side to warn the customer that if the user leavers the Xero org the connection will be broken.

However, we noticed that the xero-user-id doesn't correspond with the user_id returned by the Users API.

How do we use the xero-user-id returned in the Oauth2 flow to match to the Xero User?
A user has a user id linked to their Xero login but will have a different id as a resource inside a Xero organisation and so you will not be able to match the two.

All you can do is to add the warning in any documentation you have around making the connection in the first place and deleting users.

Sally C (Community Manager)