Giter Site home page Giter Site logo

Comments (4)

uchipro avatar uchipro commented on August 29, 2024

В моём случае похоже, что вместо '&' из-за настроек системы используется '&'. После чего при попытке получения токена возвращается {"error":"invalid_client","error_description":"Client authentication failed.","message":"Client authentication failed.","error_code":1}. Кажется, что вы не можете из запроса получить client_id или client_secret. Думаю, было бы хорошо, если бы в тексте ошибки сразу указывалось, что такой-то параметр не передан.

from sendpulse-rest-api-php.

sendpulse avatar sendpulse commented on August 29, 2024

Пожалуйста, предоставьте пример вашего кода, который приводит к ошибке, а также ответ сервера.

from sendpulse-rest-api-php.

uchipro avatar uchipro commented on August 29, 2024

Создал для теста новый каталог, в нем выполнил composer require sendpulse/rest-api.
Создал index.php с кодом:

<?php

ini_set('arg_separator.output', '&amp;'); // Такая строчка используется в движке, в котором планирую использовать вашу библиотеку.

require 'vendor/autoload.php';

use Sendpulse\RestApi\ApiClient;
use Sendpulse\RestApi\Storage\FileStorage;

$SPApiClient = new ApiClient('848bc4db4a46a004d6669534100f6729', '392c407612e81862b1302a77848e3848');

Запускаю и получаю результат:

php index.php 
PHP Fatal error:  Uncaught Exception: Could not connect to api, check your ID and SECRET in /tmp/sendpulse/vendor/sendpulse/rest-api/src/ApiClient.php:63
Stack trace:
#0 /tmp/sendpulse/index.php(10): Sendpulse\RestApi\ApiClient->__construct('848bc4db4a46a00...', '392c407612e8186...')
#1 {main}
  thrown in /tmp/sendpulse/vendor/sendpulse/rest-api/src/ApiClient.php on line 63

В то же время если выполнить curl с теми же данными с той же машины:

curl -d "grant_type=client_credentials&client_id=848bc4db4a46a004d6669534100f6729&client_secret=392c407612e81862b1302a77848e3848" -X POST https://api.sendpulse.com/oauth/access_token

возвращается:

{"access_token":"7N3B9aMhA0UFt3CsnDnHqW0HSlErJrxzTLFms8b0","token_type":"Bearer","expires_in":3600}

from sendpulse-rest-api-php.

burre avatar burre commented on August 29, 2024

Мы не поддерживаем работу с разделителем, который вы используете в коде.

from sendpulse-rest-api-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.