xoauth icon indicating copy to clipboard operation
xoauth copied to clipboard

xoauth does not output to environment variables on MS Windows

Open DavidHChamp opened this issue 5 years ago • 2 comments

I have implemented xoauth on Windows 10.

It is working except that the '--env' / '-e' switches do not export to environment variables. I have also tried creating the variables in advance on a user account and as system variables but it still does not enter data to them.

Please can this be fixed as the work-around I have via exporting to a file is not robust enough.

DavidHChamp avatar Jun 22 '20 10:06 DavidHChamp

As windows lacks an eval() equivalent, I don't think there's an easy way to do this. Even on unix systems you need to eval the output, as a process can only set env_vars for itself and any child processes.

We could add a feature have xoauth generate the temp file, e.g by performing xoauth token -o ./my-env.bat or similar?

JoshBarr avatar Sep 02 '20 00:09 JoshBarr

Hi Josh

Thanks for the response.

I am a little confused by your email though, I had expected it to work as it was in your specification (READE.ME file).

On Windows you can set environment variables for user or system level using setx, e.g. "setx variable value" or "setx /m variable value" Also I don't understand why you suggest generating a .bat file, would this be to run a command or to contain the tokens?

I can already use xoauth to export to a file using "xoauth token xero -e > C:\temp\token.txt", I then read it in and parse the contents into my application.

If you can't setup the environment variables directly (which is a shame as I could read these from my application code) what would be more useful for me is for the refresh command to refresh and export using one command e.g. "xoauth token xero -re C:\temp\token.txt"

Regards David [email protected]

On 2 Sep 2020, at 01:34, Josh Barr [email protected] wrote:

As windows lacks an eval() equivalent, I don't think there's an easy way to do this. Even on unix systems you need to eval the output, as a process can only set env_vars for itself and any child processes.

We could add a feature have xoauth generate the temp file, e.g by performing xoauth token -o ./my-env.bat or similar?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/XeroAPI/xoauth/issues/13#issuecomment-685207139, or unsubscribe https://github.com/notifications/unsubscribe-auth/APA5VYNQSVD2QJMEE3EHCALSDWHI3ANCNFSM4OEOUAOQ.

DavidHChamp avatar Sep 03 '20 15:09 DavidHChamp