Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instagram credentials are not stored in site.txt on server #7

Open
lmgringhuis opened this issue Aug 8, 2022 · 4 comments
Open

Instagram credentials are not stored in site.txt on server #7

lmgringhuis opened this issue Aug 8, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@lmgringhuis
Copy link

When tested on local everything seems to work perfectly. However, when placed on a testing server, the Instagram credentials are not saved in the site.txt file, only the refreshed date:

Instagramauth: 

----

Instagramtoken: 

----

Instagramtokenrefreshed: 2022-08-08

The test server is running the same 3.7.0.1 Kirby instance and is running on PHP 8.1. Any idea why this is not working?

@lmgringhuis
Copy link
Author

It seems that the catch is triggered in the fetch function, even if the call was succesfull. Doing that it overwrites the Instagram credentials:

catch(\Exception $e)
        {
            site()->update([
                'instagramAuth' => (boolean)false,
                'instagramToken' => '',
            ]);
        }

If I add this the credentials are stored:

catch(\Exception $e)
        {
            die(var_dump($e));
        }

The exception isn't shown. Have to put some extra logging in place to see what happens. Very strange that this is not happening on my local dev environment.

@lmgringhuis
Copy link
Author

Extra logging on the exception below. I tried some debugging myself but can't really understand this error, because the values are there and are set.. Everything works perfectly if I prevent the exception catch from triggering.

Whoops\Exception\ErrorException: Undefined array key "access_token" in /site/plugins/kirby3-instagram/classes/Instagram.php:59
Stack trace:
#0 /site/plugins/kirby3-instagram/classes/Instagram.php(59): Whoops\Run->handleError()
#1 /site/plugins/kirby3-instagram/index.php(21): X\Instagram->getToken()
#2 [internal function]: Kirby\Http\Route->{closure}()
#3 /kirby/src/Http/Router.php(131): Closure->call()
#4 /kirby/src/Cms/App.php(337): Kirby\Http\Router->call()
#5 /kirby/src/Cms/App.php(1242): Kirby\Cms\App->call()
#6 /index.php(5): Kirby\Cms\App->render()
#7 {main}

@samzzi
Copy link
Contributor

samzzi commented Aug 11, 2022

Hi @lmgringhuis I'm quite busy atm so I'll take a look at this in the coming 2 weeks. Can't reproduce though so this will be a challenge to find out. (and very strange that it still works if you remove the catch because you need an access_token from instagram to have this working 🤔)

@samzzi samzzi added the bug Something isn't working label Aug 11, 2022
@samzzi samzzi self-assigned this Aug 11, 2022
@samzzi
Copy link
Contributor

samzzi commented Aug 11, 2022

And already thanks for your investigation and feedback btw @lmgringhuis 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants