protected function getIdByName($names) { $auth0 = new Client(['domain' => 'https://login.auth0.com', 'basePath' => '/api/v2']); $response = $auth0->get()->clients()->withHeader(new AuthorizationBearer($this->token))->call(); foreach ($response as $client) { if (in_array($client->name, $names)) { return $client->client_id; } } die('APP DOES NOT EXISTS'); }
public function testGetAllWithStrategyAndWithoutFields() { $auth0 = new Client(['domain' => 'https://login.auth0.com', 'basePath' => '/api/v2']); $response = $auth0->get()->connections()->withHeader(new AuthorizationBearer($this->token))->withParam('strategy', 'facebook')->withParam('fields', 'name,id')->withParam('include_fields', false)->call(); $this->assertTrue(is_array($response)); $this->assertCount(1, $response); $this->assertObjectNotHasAttribute('name', $response[0]); $this->assertObjectNotHasAttribute('id', $response[0]); $this->assertObjectHasAttribute('strategy', $response[0]); $this->assertEquals('facebook', $response[0]->strategy); }
public function testRo() { $auth0 = new Client(['domain' => 'https://wptest.auth0.com', 'basePath' => '/']); $response = $auth0->get()->oauth()->ro()->withHeader(new ContentType('application/json'))->withBody(json_encode(["client_id" => "5tUy41aD5PcReduVKTDdZXfRySdXsQA7", "username" => "*****@*****.**", "password" => "123456", "connection" => "Username-Password-Authentication", "grant_type" => "password", "scope" => "openid"]))->call(); var_dump($response); }
public function testList() { $auth0 = new Client(['domain' => 'https://login.auth0.com', 'basePath' => '/api/v2']); $response = $auth0->get()->users()->withHeader(new AuthorizationBearer($this->token))->withParam('per_page', 1)->call(); var_dump($response); }