xero-node | Xero Node SDK for OAuth | REST library
kandi X-RAY | xero-node Summary
kandi X-RAY | xero-node Summary
Xero Node SDK for OAuth 2.0 generated from XeroAPI/Xero-OpenAPI
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of xero-node
xero-node Key Features
xero-node Examples and Code Snippets
Community Discussions
Trending Discussions on xero-node
QUESTION
Attempting to create a firebase function that is triggered by some database or onRequest event that creates payments on Xero to better manage incoming invoices.
Not sure I understand how to run (if its possible) the xero-node library from firebase functions.
I have been messing around with the two and it doesn't seem to be as simple as initialising the object with the secret ID and calling functions like i would expect:
...ANSWER
Answered 2020-Sep-29 at 16:50EDIT: Ah I think what you need to do is just initialize the client the second time using:
QUESTION
I am using the following: https://github.com/XeroAPI/xero-node
I am using a React app, talking to a Nodejs backend. The React app calls the node file connect.js as per the below:
...ANSWER
Answered 2020-Jun-09 at 17:24So the error is because the Xero client has not yet been properly initialized.
https://github.com/XeroAPI/xero-node/blob/master/src/XeroClient.ts#L99
As you can see on the code below (linked above) the callbackParams function is a method on the openIdClient ( an oauth2.0 library ) - in order to fully setup they client you will need to call either xero.initialize()
or xero.buildConsentUrl()
It also looks like you should be passing back the req.url, though the req.body might still work..
QUESTION
I am building Angular app that should interact with Xero API. Xero doesn't provide any SDK for Typescript (https://developer.xero.com/documentation/libraries/overview), but Node JS SDK seems to be the most useful lib for my task. But I am in stuck in how to organize the workflow between my app and their https://github.com/XeroAPI/xero-node-oauth2-app . I mean - I'd like to have some advises from the person who has already made similar apps (Angular + Xero) on following questions:
1) in this guide https://developer.xero.com/documentation/oauth2/auth-flow they say that user should open the page with URL like https://login.xero.com/identity/connect/authorize?...
- but is there any way to make user log in without UI? If not -
2) how this process can be made in my case? In my Angular app I can make a button 'Log in to Xero' that will open new window:
ANSWER
Answered 2020-May-25 at 23:27Unfortunately, SPAs are not compatible with the Xero API.
You'll need a web server to manage your local session (OAuth flow, storage of Xero API tokens), and for your interactions with the Xero API.
While SPAs are a tempting option (they are convenient from a deployment point of view), there are changes coming to how browsers handle cross-site cookies, which break how SPAs perform session management.
I'd suggest reading https://leastprivilege.com/2020/03/31/spas-are-dead/ for more information and a discussion of the implications. The authors of the article created OIDC Client JS which is a great library for doing PKCE-based SPA auth in the browser, though it's only useful for same-domain applications now thanks to the impending browser cookie changes.
Further to this, the Xero API does not support CORS, so even once you complete the OAuth flow, the browser would be prevented from performing API requests from your Angular SPA.
To answer the specific questions:
1) The user will need to log in to Xero and grant consent for your app the first time they use your application. If you're storing server-side refresh tokens after the initial consent, your user will only need to log in to your local session, either via Xero SSO or another mechanism (user/password).
2) To create the initial Authorisation Request, it's best to use the node.js starter app. It will manage the OAuth redirect flow for you (it uses the excellent openid-client open source package for this).
QUESTION
I am using the Xero Api with Nodejs and the xero-node library.
I have completed the oAuth flow and saved the token to the database. The issue i am now having is continually getting a 403 forbidden error when attempting to get anything from Xero be that Contacts, Accounts or Users. Sample code is below
I can get tenants ok without an issue however anything else doesn't work. I have checked the scopes to make sure when I am setting up the client they are correct which they are.
...ANSWER
Answered 2020-May-21 at 15:53Which scopes have been added to the access token you are passing through? You can decode your token here https://jwt.io/
Also - you need to pass the ‘tenant.tenantId’ to the function. I believe the tenant.id actually relates to the connection id which is coming back from the /connections endpoint.
My hunch is that is the issue. Also curious how that’s working, as updateTenants() should have the empty function call on the end. Is that working for you?
QUESTION
I have currently implemented a NodeJs, express api with the xero-node
sdk package, and I've run into an issue where it doesn't seem that the OAuth state parameter is not being used (though I see it is defined as an optional parameter for the XeroClient constructor:
ANSWER
Answered 2020-Feb-04 at 23:34Here is how you pass state through the OAuth flow using the xero-node
SDK:
https://github.com/SerKnight/xero-node-basic-app/blob/master/index.js#L37
Example:
- first generate the consentUrl, then append your custom params.
QUESTION
I am working on a Xero integration and am having some issues setting up the XeroClient from the SDK. We are currently working in a React app written with Typescript.
Currently I am importing Xero SDK like this:
...ANSWER
Answered 2020-Jan-06 at 19:11Currently the xero-node project requires a backend to authenticate.. Is this a react SPA, or you are just setting up the API calls in the component?
Will OAuth 2.0 support desktop/mobile/single-page apps that can’t keep a client secret confidential?
At the moment, we require that your app can keep a client secret confidential. We are currently evaluating the PKCE extension to better support SPAs and mobile apps.
https://developer.xero.com/faq/oauth2/oauth-non-secret
Your Console error looks like its just the Unused vars expression.. Here is some context on what that is ( https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unused-vars.md )
Your Secondary browser error makes me think that you are using an older version of Node.. We need to add an .npmrc
that forces a supported node version - are you using an older Node VSN?
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install xero-node
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page