Code Monkey home page Code Monkey logo

Comments (11)

jeznag avatar jeznag commented on September 17, 2024

@MJMortimer Do you mean this type of 401?

%{message: %{"oauth_problem" => "token_rejected",
    "oauth_problem_advice" => "Token XXX does not match an expected ACCESS token"},
  status_code: 401}

Is there any workaround? The SDK seems to work fine for my test Xero account but not for the real one :( It works fine with https://www.npmjs.com/package/xero Can you point me to where I might need to make a fix?

from elixero.

MJMortimer avatar MJMortimer commented on September 17, 2024

No, the 401 error that this produces are "Failed to validate signature" errors. Reason being, the SDK signs it one way but the API signs it differently and so the signatures don't match

from elixero.

jeznag avatar jeznag commented on September 17, 2024

Hmm any idea why I might be getting that error with one xero account but not another (bearing in mind it works fine with a Node SDK so is not an issue with the credentials)? Can I ask why you wrote your own oauth module rather than using one of the oauth modules from mix? Is it worth trying that?

from elixero.

MJMortimer avatar MJMortimer commented on September 17, 2024

What type of application have you created?
If it's a public app you'll need to make sure you are going through the oauth flow each time the token expires after 30 minutes and for each organisation you connect to.

The oauth 1.0 implementation used in the Xero API is a little bit custom and so I wasn't sure if any other oauth modules would work correctly. If you'd like to look into switching it out for another module from mix I'll be happy to look through any changes.

from elixero.

jeznag avatar jeznag commented on September 17, 2024

It's a private app.

Hmm ok I might try using another module. I noticed the node implementation used an off the shelf oauth module which gives me hope.

from elixero.

MJMortimer avatar MJMortimer commented on September 17, 2024

Have you created a private app for each organisation?

from elixero.

jeznag avatar jeznag commented on September 17, 2024

Yeah it works for one organisation but not the other.

from elixero.

MJMortimer avatar MJMortimer commented on September 17, 2024

Weird.
Have you tried recreating the failing private app or generating new keys for the failing private app?

Also, I'm sure you've checked this but, have you definitely provided the consumer key and secret in the correct properties in the config (they haven't been mixed up or a character missing off the end etc)

from elixero.

jeznag avatar jeznag commented on September 17, 2024

Yeah I have. Will try again just in case.

from elixero.

MJMortimer avatar MJMortimer commented on September 17, 2024

Also if you've created different signing keys for each you should make sure you're using the correct one

from elixero.

jeznag avatar jeznag commented on September 17, 2024

For some reason running mix deps.compile fixed this issue. Don't understand why 🤷‍♂️
Thanks for your help!

from elixero.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.