3

I am trying to request the XERO demo company data via its API using R programming language.

I am getting the following error:

Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission,  : 
  Unauthorized (HTTP 401).

In addition, there is a warning message:

In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'

Here is my code:

# establish connection authentication

xero_endpoint <- oauth_endpoint(
  request = "RequestToken",
  authorize="Authorize", 
  access = "AccessToken",
  base_url = "https://api.xero.com/oauth")

# use the key XERO provided
xero_app <- oauth_app("church_xero_in_r",
          key = xero_key,
          secret = xero_secrect
          )

# connect to Xero API
oauth1.0_token(endpoint = xero_endpoint, app = xero_app)

Basically, I was trying to connect the Xero API by using the key provided. I have googled many articles but seems like none can solve my problem.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
  • I believe that this question can get you access: https://stackoverflow.com/questions/64923454/api-oauth-2-0-xero-acces-with-r-receiving-status-400 – Charlie Sweetland Dec 01 '20 at 11:49

0 Answers0