XeroAPI / xoauth

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

Save to environment? #4

Closed ruraldev closed 4 years ago

ruraldev commented 4 years ago

Should the following command save the tokens to the environment? xoauth token xero --refresh --env It doesn't seem to work for me

JoshBarr commented 4 years ago

Hey @ruraldev,

Unfortunately, when a process sets environment variables, it only applies to itself and any children - a process isn't allowed to modify global environment directly. The solution is to eval the output as follows:

eval "$(xoauth token xero --refresh --env)"

I noticed we had a typo in the docs (missing $ and quotes around the subshell). I have amended the docs to reflect correct usage.