Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"error":"no_method","error_message":"Could not find a route with 2 elements"}
- $config = Drupal::config('example.settings');
- $instance_url = $config->get('api_url');
- $username = $config->get('username');
- $password = $config->get('password');
- $auth_url = $instance_url . "/oauth2/token";
- $oauth2_token_arguments = array(
- "grant_type" => "password",
- "client_id" => "example",
- "client_secret" => "",
- "username" => $username,
- "password" => $password,
- "platform" => "custom_api"
- );
- $auth_request = curl_init($auth_url);
- curl_setopt($auth_request, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
- curl_setopt($auth_request, CURLOPT_HEADER, false);
- curl_setopt($auth_request, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($auth_request, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($auth_request, CURLOPT_FOLLOWLOCATION, 0);
- curl_setopt($auth_request, CURLOPT_HTTPHEADER, array(
- "Content-Type: application/json"
- ));
- $json_arguments = json_encode($oauth2_token_arguments);
- curl_setopt($auth_request, CURLOPT_POSTFIELDS, $json_arguments);
- $oauth2_token_response = curl_exec($auth_request);
- https://example.com/rest/v10/oauth2/token?grant_type=password&username=xxxxxx&password=xxxxxx&client_id=sugar&client-secret=&platform=base
Add Comment
Please, Sign In to add comment