Search code examples
xero-api

Xero - OAuth1 to OAuth2 migration


I started working with adding migration from OAuth1a to OAuth2 inside my application and i face some problems.

This is what I've done :

  1. I updated my partner app just like it is described here https://developer.xero.com/documentation/oauth2/migrate (added Auth2.0 redirect , got client id and secret etc ...)
  2. I implemented token migration exactly as it is done here https://github.com/XeroAPI/xero-net-oauth2-sampletokenmigration and it works fine when OAuth1 token is valid :)

But when it is invalid and I'm doing refresh (using app updated in step 1) and call ~/oauth/migrate endpoint (using access token that i just recived after refresh step) to get OAuth2 token. I'm reciving this error "You can only migrate an OAuth1.0a connection to an OAuth2.0 connection for the currently authorised app". Also same thing happen when i create new connection (using partner applications created in in step 1) and than try to migrate this access token to Auth2.0.

Can anybody point me what I'm doing wrong ?


Solution

  • That is the error returned when you try to migrate to a newly created app. Are you sure you are using the tokens from the same Partner app tile in your /myapps dashboard.

    It should look something like this, once you've added the correct OAuth2 redirect uri and generated your secret.

    example partner upgrade