I'm trying to use Hybridauth (ver 3) to get a list of an authenticated user's WordPress blogs, using the https://public-api.wordpress.com/rest/v1.1/me/sites endpoint. Figured out that in order to do so, I need to change the default authorize_url endpoint for WordPress from https://public-api.wordpress.com/oauth2/authenticate to https://public-api.wordpress.com/oauth2/authorize.
Hybridauth lets you change the endpoint, as in this example here: https://github.com/hybridauth/hybridauth/blob/master/examples/example_03.php
Unfortunately, this results in the following error:
Fatal error: Uncaught TypeError: Argument 1 passed to Hybridauth\Adapter\AbstractAdapter::setApiEndpoints() must be an instance of Hybridauth\Data\Collection, array given
The code:
$config = [
"callback" => APP_URL."/callback",
"keys" => array("id" => "XXXXXX", "secret" => "YYYYYYYYYY"),
"scope" => array("global", "auth"),
"endpoints" => [
"authorize_url" => "https://public-api.wordpress.com/oauth2/authorize",
]
];
$adapter = new Hybridauth\Provider\WordPress($config);
What am I doing wrong? I feel like I'm missing out on something horribly obvious.
from Having trouble setting custom endpoints for Hybridauth provider (WordPress)
No comments:
Post a Comment