Page MenuHomePhabricator

Support Conduit tokens in ConduitClient
ClosedPublic

Authored by epriestley on Dec 12 2014, 11:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Feb 26, 8:52 AM
Unknown Object (File)
Fri, Feb 23, 8:16 AM
Unknown Object (File)
Thu, Feb 22, 7:28 PM
Unknown Object (File)
Wed, Feb 21, 11:28 PM
Unknown Object (File)
Tue, Feb 20, 5:19 AM
Unknown Object (File)
Fri, Feb 9, 5:31 AM
Unknown Object (File)
Sat, Feb 3, 1:28 AM
Unknown Object (File)
Jan 31 2024, 7:34 PM
Subscribers

Details

Summary

Ref T5955. Allow ConduitClient to use simple token-based authentication.

Test Plan
$ cat conduit.php 
<?php

require_once 'scripts/__init_script__.php';

$args = new PhutilArgumentParser($argv);
$args->parseStandardArguments();

$result = id(new ConduitClient('http://local.phacility.com'))
  ->setConduitToken('api-6br7udiaydzjxorsr4ooggtzissh')
  ->callMethodSynchronous('user.whoami', array());

var_dump($result);
$ php -f conduit.php -- --trace
>>> [0] <conduit> user.whoami() <bytes = 117>
>>> [1] <http> http://local.phacility.com/api/user.whoami
<<< [1] <http> 216,804 us
<<< [0] <conduit> 217,307 us
array(6) {
  ["phid"]=>
  string(30) "PHID-USER-cvfydnwadpdj7vdon36z"
  ["userName"]=>
  string(5) "admin"
  ["realName"]=>
  string(4) "asdf"
  ["image"]=>
  string(85) "http://local.phacility.com/res/1410737307T/phabricator/3eb28cd9/rsrc/image/avatar.png"
  ["uri"]=>
  string(35) "http://local.phacility.com/p/admin/"
  ["roles"]=>
  array(4) {
    [0]=>
    string(5) "admin"
    [1]=>
    string(8) "verified"
    [2]=>
    string(8) "approved"
    [3]=>
    string(9) "activated"
  }
}

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Support Conduit tokens in ConduitClient.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Dec 15 2014, 6:43 PM
This revision was automatically updated to reflect the committed changes.