Confluence command line interface tokens not working

I can't get login tokens to work.

>> confluence --action login --user poulton --password mypass

successfully returns a token Er9NXZafyy . But then I can't do actions with that token:

>> confluence --action getSpaceList --login Er9NXZafyy
Error: Parameter 'password' is required.

>> confluence --action getSpaceList --loginFromStandardInput < junk.l
Error: Parameter 'password' is required.

I'm using Confluence 3.5.6

1 answer

1 accepted

Use --password "". It will be ignored if the action you are using does not require a password and a token is provided. The token only works for SOAP based actions and a password is still required for non-SOAP actions. For Confluence, almost all actions are SOAP based still.

Okay, this works:

>> confluence --action getSpaceList --user poulton --password "" --login Er9NXZafyy

It seems like a bug to me that when --login is used it still requires a null --password. Even an error message that says this is required would address this.

There is a different bug in --loginFromStandardInput:

>> confluence --action login --user poulton --password mypass >junk.l
>> confluence --action getserverInfo --user poulton --password "" --loginFromStandardInput <junk.l

Remote error: com.atlassian.confluence.rpc.InvalidSessionException: User not authenticated or session expired. Call login() to open a new session

The problem turns out that it is expecting the DOS CR-LF in the file! When I run this command on Linux, text file lines have only LF on each line as God and Dennis Ritchie intended.

A workaround for Linux users:

>>confluence --action login --user poulton --password wikiwiki | sed 's/$/^M/' >junk.l

where "^M" is ctrl-M (a.k.a. CR).

It seems like the Linux version of the confluence(1) CLI binary ought not to be expecting CR-LF.

Yes, its a bit of an oddity that I have choosen not to fix. Password was always required (for all clients) before token support was added and in 99.9% of cases it is a convenient way to prevent people from forgetting to use it. Token support is limited to the SOAP request and is for more advanced users, etc... Over time non-SOAP requests will dominate (JIRA especially and eventually Confluence), so just leaving it as is.

Regarding your other issue, I opened CSOAP-178

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,118 views 59 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you