PHP Login setup

Hi, how are you all?

Im new using Patreon as a Login method

And using some examples, I was able to create the login… however, I can’t use the information sent back by Patreon,

Im getting this:
Art4\JsonApiClient\Document Object
(
[container:protected] => Art4\JsonApiClient\Utils\DataContainer Object
(
[allowed_keys:protected] => Array
(
)

        [data:protected] => Array
            (
                [data] => Patreon\JSONAPI\ResourceItem Object
                    (
                        [resource_item:protected] => Art4\JsonApiClient\ResourceItem Object
                            (
                                [container:protected] => Art4\JsonApiClient\Utils\DataContainer Object
                                    (
                                        [allowed_keys:protected] => Array
                                            (
                                            )

                                        [data:protected] => Array
                                            (
                                                [type] => user
                                                [id] => 12345678
                                                [attributes] => Art4\JsonApiClient\Attributes Object
                                                    (
                                                        [container:protected] => Art4\JsonApiClient\Utils\DataContainer Object
                                                            (
                                                                [allowed_keys:protected] => Array
                                                                    (
                                                                    )

                                                                [data:protected] => Array
                                                                    (
                                                                        [about] => 
                                                                        [can_see_nsfw] => 1
                                                                        [created] => 2019-05-19T23:28:09.000+00:00
                                                                        [default_country_code] => 
                                                                        [discord_id] => 

So, what I want to get is the name, the icon, not sure if I need the email… but, and most importantly… if the user has an active pledge on my patreon account, so I can give access to different type of information depending on his current tier.

Y try doing this:
$patron_response = $api_client->fetch_user();
$first_name = $patron_response[‘data’][‘attributes’][‘first_name’];
$last_name = $patron_response[‘data’][‘attributes’][‘last_name’];
$full_name = $patron_response[‘data’][‘attributes’][‘full_name’];
echo $first_name;

But got this error:
Fatal error: Uncaught Error: Cannot use object of type Art4\JsonApiClient\Document as array in /var/mysite.com/patreon/index.php:53
Stack trace:
#0 {main}
thrown in /var/mysite.com/patreon/index.php on line 53

Can some one help? :smile:

Hi I know this is several month old, but since there is no real tech support to speak of here, I will answer in case someone stumbles upon this thread with the same issue.

Basically don’t use composer to get your package.

It is very outdated compared to the one on github.
I recently faced the exact same issue and even reported it on github

They since updated readme on git to reflect that fact.