Behaviour is observable on this very Phabricator instance; I do not know which version that runs. However, it is also observable on the week 29 stable promotions (the instance I run, and first found this on, has a reasonable amount of local changes, but none which touch this codepath, so here are the upstream SHAs):
- Phabricator: rP9da15fd7ab7071e3b7361463229abd4e918d9d94
- Arcanist: rARCf1c45a3323ae20eefe29c0a22c7923fe8b151bbf
- libphutil: rPHU5fd2cf9d5ddd38424a54a8fba02398d527639970
Have a site which 302 redirects HTTP -> HTTPS, e.g. http://secure.phabricator.com.
Run arc install-certificate http://that.site (not HTTPS!), obtaining a new API token and pasting it in as instructed.
Receive a confusing error message complaining you lack a session key, even though you just got the token from the link like instructed.
strictly:~% arc install-certificate http://secure.phabricator.com --trace
ARGV '/home/daniels/src/phabricator/arcanist/bin/../scripts/arcanist.php' 'install-certificate' 'http://secure.phabricator.com' '--trace'
LOAD Loaded "phutil" from "/home/daniels/src/phabricator/libphutil/src".
LOAD Loaded "arcanist" from "/home/daniels/src/phabricator/arcanist/src".
Config: Reading user configuration file "/home/daniels/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: No candidate locations for .arcconfig from this working directory.
Working Copy: Path "/home/daniels" is not in any working copy.
CONNECT Connecting to "http://secure.phabricator.com/api/"...
>>> [0] <conduit> conduit.ping() <bytes = 39>
>>> [1] <http> http://secure.phabricator.com/api/conduit.ping
<<< [1] <http> 1,308,376 us
<<< [0] <conduit> 1,311,549 us
>>> [2] <conduit> conduit.getcapabilities() <bytes = 39>
>>> [3] <http> http://secure.phabricator.com/api/conduit.getcapabilities
<<< [3] <http> 429,877 us
<<< [2] <conduit> 430,641 us
LOGIN TO PHABRICATOR
Open this page in your browser and login to Phabricator if necessary:
http://secure.phabricator.com/conduit/login/
Then paste the API Token on that page below.
Paste API Token from that page: cli-xxxx
>>> [4] <conduit> user.whoami() <bytes = 117>
>>> [5] <http> http://secure.phabricator.com/api/user.whoami
<<< [5] <http> 458,490 us
<<< [4] <conduit> 459,419 us
Usage Exception: The token "cli-xxxx" is not a valid API Token. The server returned this response when trying to use it as a token: ERR-INVALID-SESSION: Session key is not present.
[2016-07-22 16:44:35] EXCEPTION: (ArcanistUsageException) The token "cli-xxxx" is not a valid API Token. The server returned this response when trying to use it as a token: ERR-INVALID-SESSION: Session key is not present. at [<arcanist>/src/workflow/ArcanistInstallCertificateWorkflow.php:134]
arcanist(head=ccu, ref.master=6cb13cc16dc0, ref.ccu=8c016bb47f3f), phutil(head=ccu, ref.master=a6802e4d6b5f, ref.ccu=5fd2cf9d5ddd)
#0 ArcanistInstallCertificateWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]
zsh: exit 255 arc install-certificate http://secure.phabricator.com --trace
strictly:~% echo '{}' | arc --conduit-uri http://secure.phabricator.com/api/ --conduit-token cli-xxxx call-conduit user.whoami
Exception
ERR-INVALID-SESSION: Session key is not present.
(Run with `--trace` for a full exception trace.)
zsh: done echo '{}' |
zsh: exit 1 arc --conduit-uri http://secure.phabricator.com/api/ --conduit-token
strictly:~% echo '{}' | arc --conduit-uri https://secure.phabricator.com/api/ --conduit-token cli-xxxx call-conduit user.whoami
{"error":null,"errorMessage":null,"response":{"phid":"PHID-USER-5atcce37qlwkkojcfupc","userName":"fooishbar","realName":"Daniel Stone","image":"https:\/\/p.phcdn.net\/file\/data\/@secure\/xy5sl74zq4z6fbskjevs\/PHID-FILE-pvhkk3dtagczflcpr5uq\/profile-10525781_10152557377385941_5502342738383595126_n.jpg","uri":"https:\/\/secure.phabricator.com\/p\/fooishbar\/","roles":["verified","approved","activated"],"primaryEmail":"daniel@fooishbar.org"}}