You are here

public function Connections::create in Auth0 Single Sign On 8.2

Create a new Connection. Required scope: "create:connections"

@link https://auth0.com/docs/api/management/v2#!/Connections/post_connections

Parameters

array $data Connection create data; "name" and "strategy" fields are required.:

Return value

mixed|string

Throws

\Exception Thrown by the HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/src/API/Management/Connections.php, line 158

Class

Connections
Class Connections. Handles requests to the Connections endpoint of the v2 Management API.

Namespace

Auth0\SDK\API\Management

Code

public function create(array $data) {
  if (empty($data['name'])) {
    throw new \Exception('Missing required "name" field.');
  }
  if (empty($data['strategy'])) {
    throw new \Exception('Missing required "strategy" field.');
  }
  return $this->apiClient
    ->method('post')
    ->addPath('connections')
    ->withBody(json_encode($data))
    ->call();
}