0

I wanted to connect to Xero API and I have this following codes:

using Xero.Api;
using Xero.Api.Core;
using Xero.Api.Example.Applications.Public;
using Xero.Api.Infrastructure.OAuth;
using Xero.Api.Infrastructure.Interfaces;
using Xero.Api.Serialization;

var public_app_api = new XeroCoreApi("https://api.xero.com", new PublicAuthenticator("https://api.xero.com", "https://api.xero.com", "oob",
                new MemoryTokenStore()),
                new Consumer("KOWORD7XK14UL1HOKJO2YQIHMHB8NV", "CDMNUVXXF8PN8UFZGJJXCWR1P8SAL6"),user,
                new DefaultMapper(), new DefaultMapper());
var public_contacts = public_app_api.Contacts.Find().ToList();

My problem is I got this error:

oauth_problem=permission_denied & oauth_problem_advice=The consumer was denied access to this resource

And I will be directed to Authorize the Application and they provide the code to enter but I don't know where I can enter those codes. Can someone help me on this? Thanks.

Jen143Me
  • 273
  • 7
  • 24

1 Answers1

0

The code returned is an oauth verifier ("oauth_verifier") and it should be provided in your call to obtain access token.

Its basically appending your Authorize URL with your 'oauth_verifier' something like this : https://api.xero.com/oauth/AccessToken?oauth_consumer_key=WLVBLGE7EIDADYYUDMUUI8N4JYXNZ6&oauth_token=QDND3QPOOJAYC0CRPRDVSR8QBIPPXL&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1494813490&oauth_nonce=1cdSIE&oauth_version=1.0&oauth_signature=zL5XYfAi1+3GUtvx/J5prvbhCVI=&oauth_verifier=2654410

Sri
  • 1