Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

Got error Error: unauthorized_client : Invalid redirect_uri with Xero OAuth 2.0

Started by Khanh Tran -   in API Authentication

Hi there,

I tried with Xero OAuth 2.0 login in local using this PHP package, https://github.com/calcinai/xero-php, but got error below, here is an error ID https://login.xero.com/identity/error?errorId=CfDJ8D2PBYkkQr1In4_V8o_RcmTPILlyVRFo-5UEgIl-gB9DbsBubqS6uaspzQbpjxJ4K_J-Xw5UMoPCmjn9qjYIEtY7yTE7bB0Q6MWjZ2lW-LssqsSeQ02hM6QpBcxyKxCKCa1rAX0wEgUj45M7UTlkc-wyhs14-9FovRKwmlv0q2NlFNbomYgoDUOUBLxURGqaarDlgNTVjx7Ju7iduT8S9n-vKFW1RuftGW8RgdPH141qL274DBsSdf4FSkzqmB_n-O1EgWJVq_RrIjN47hlFh7qFmXYAm-7S35iSX_kIbZpgJTutkH7sH1vSupgJWQm_3mmdmdtKHLKFChgIXwEklUvfJYDXf91w0qsu-s1lVtT5boyJIEZW4IeWoivWlo0XDg.

Error code: 500
Error: unauthorized_client : Invalid redirect_uri

My local web admin app is: https://dev.graphicsnw.loc/admin/index.php

Name in Xero developer account: Zeus 2.0
Company or application URL in Xero developer account: https://dev.graphicsnw.loc
My OAuth 2.0 redirect URIs in Xero developer account: https://dev.graphicsnw.loc/admin/index.php?route=module/xero/auth&token=719895f45eba00619a030508377cf7c1
Client ID in Xero developer account: 5AE82F8B4056436D8B7B860BF0067A23

Please take a look and let me know what wrong with my redirect URI.

Thanks!
Somehow it works now with My OAuth 2.0 redirect URIs in Xero developer account: https://dev.graphicsnw.loc/admin/index.php?route=module/xero/auth&token=719895f45eba00619a030508377cf7c1.

Another question is since this is for the admin, it needs a token in the URI to access to the admin when it redirects back. Is there a way that we can give a token dynamically so it is not always 719895f45eba00619a030508377cf7c1?

Thanks!
 

Khanh Tran