XeroAPI / xoauth

A CLI tool for obtaining JWTs from OpenId Connect providers
MIT License
49 stars 16 forks source link

executable file not found #5

Open kcardona86 opened 4 years ago

kcardona86 commented 4 years ago

on Linux after using ./xoauth connect Company1 the below error was thrown when attempting to create a connection but even when creating a token.

kristian@linux-testing:~$ ./xoauth connect Company1
panic: exec: "dbus-launch": executable file not found in $PATH

goroutine 1 [running]:
github.com/xero-github/xoauth/pkg/connect.Authorise(0x7ffd494e2778, 0xd, 0xc0000c1d01, 0x1f90)
/home/runner/work/xoauth/xoauth/pkg/connect/connect.go:34 +0x585
github.com/xero-github/xoauth/cmd.init.0.func3(0xc0000a5900, 0xc000088880, 0x1, 0x2)
/home/runner/work/xoauth/xoauth/cmd/root.go:71 +0x5d
github.com/spf13/cobra.(*Command).execute(0xc0000a5900, 0xc000088800, 0x2, 0x2, 0xc0000a5900, 0xc000088800)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xccd960, 0x0, 0x85a3e0, 0xc00006e058)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/xero-github/xoauth/cmd.Execute(...)
/home/runner/work/xoauth/xoauth/cmd/root.go:196
main.main()
/home/runner/work/xoauth/xoauth/xoauth.go:13 +0x47
kcardona86 commented 4 years ago

Cannot delete clientName, as it throws same similar error

madhavvishnubhatta commented 4 years ago

I am also trying to experiment with xero and its API, and I ran into the same issue. I installed dbus-x11 which resolved that issue.

yum install dbus-x11

But then a new error popped up.

error creating client: The name org.freedesktop.secrets was not provided by any .service files

Then I installed gnome-keyring.

yum install gnome-keyring

With that I now have this isue:

error creating client: failed to unlock correct collection '/org/freedesktop/secrets/aliases/default'

I am not sure how to proceed further. I suspect this is because we are trying to do it on a Linux machine without a KDE or some such GUI environment. That is just a guess and I have no solid basis to say that.

I am not sure when I will get back to this, but thought I can share my progress so far for what it is worth.

kcardona86 commented 4 years ago

@madhavvishnubhatta Don't know if this helps https://rtfm.co.ua/en/what-is-linux-keyring-gnome-keyring-secret-service-and-d-bus/

scottjs commented 4 years ago

I'm facing the same issue, this is going to be running on a headless ubuntu server as part of a queued batch process.

I need the ability to authenticate to this API without having to programatically open a GUI browser to authorise the request, which seems utterly ridiculous.

Has anyone managed to make any progress with it?

ProjectZero4 commented 4 years ago

Having the same issue here. I cannot do machine to machine api calls, all because I've opted to use a headless os. Seems like a design flaw on Xero's behalf here. Can you guys please look into this?

scottjs commented 4 years ago

Having the same issue here. I cannot do machine to machine api calls, all because I've opted to use a headless os. Seems like a design flaw on Xero's behalf here. Can you guys please look into this?

It's been a nightmare for us and ended up costing our client much more work than anticipated.

We have a system where when an invoice is raised in our system, we copy it into Xero.

What we ended up having to do was implement a "Xero Authorize" settings page within the client's back office admin panel where an admin user can click the "Authorize" button, then we store the access token and refresh token in the caches.

Theoretically this only has to be done once.

The refresh token lasts 60 days, so we have a scheduled task that runs every month or so to refresh the token and store the new values in the cache.

This essentially keeps the tokens alive indefinitely and any new raised invoices will be seamlessly copied over to Xero.

Not a particularly enjoyable solution.