jmx2inc / picpuller-for-craft3

Pic Puller for Craft 3 lets authorized users pull in their Instagram media into Craft.
https://picpuller.com/
Other
12 stars 4 forks source link

Instagram Authorized App but not displaying in Craft #14

Closed DaroldFletcher closed 5 years ago

DaroldFletcher commented 5 years ago

I went through the steps to authorize a user (second user). Instagram is showing that the app is authorized. However, it does not show that authorization in Craft. It keeps repeatedly asking me to authorize.

johnfmorton commented 5 years ago

I'm sorry you're having issues, Darold. Can you tell me which version of Pic Puller you're using and which version of Craft?

johnfmorton commented 5 years ago

Just for reference, on my own multi-user site, I'm on Craft CMS 3.1.14 with Pic Puller 3.0.15.

DaroldFletcher commented 5 years ago

I'm on Craft Pro 3.0.11 and Pic Puller 3.0.13.2.

johnfmorton commented 5 years ago

Thanks. I wouldn’t expect any issue based on what I know so far.

In your browser, can you open the inspector (so you can see Javascript errors), and then try to authorize that user again? Do you see any Javascript errors that might be helpful?

DaroldFletcher commented 5 years ago

Failed to load resource: the server responded with a status of 500 (Internal Server Error) auth:231 I heard back from the post action auth:232 response: null auth:233 Uncaught TypeError: Cannot read property 'success' of null at auth:233 at Object.error (Craft.js:361) at c (jquery.js:3317) at Object.fireWith [as rejectWith] (jquery.js:3447) at l (jquery.js:9274) at XMLHttpRequest. (jquery.js:9514)

johnfmorton commented 5 years ago

Interesting. Something isn’t loading. Do you have this on a staging and production server? Is this behavior happening in both locations?

DaroldFletcher commented 5 years ago

Yes. I'm getting the error in both environments. Here is the stacktrace for the resource that's not loading 400 Bad Request.pdf

johnfmorton commented 5 years ago

It looks like you're not getting data back from the Authorization process. Added to that, it then appears I check for a "response" but not the "success" property on the response.

I don't expect this to be a total fix, but I've made a change to the 'auth' file on line 21 in the develop branch. You can see the change here:

https://github.com/jmx2inc/picpuller-for-craft3/blob/develop/src/templates/auth/index.twig#L21

Can you update that line in your staging site and then let me know what you see in the console when you try to authenticate?

DaroldFletcher commented 5 years ago

When I tried doing that, I got the same error message as stated above. The message still stays "Loading" and doesn't get updated with either of the conditionals.

However, I updated to the auth file to display the user id, instagram id, and oauth to the console. Can I just insert that information into the craft_picpuller_authorizations table or are there other things that need to get updated?

johnfmorton commented 5 years ago

You can try to update the database with the info. The "uid" is automatically generated by Craft though. See my screenshot.

http://share.jmx2.com/GyZy3Y

I'm not sure what you'd do for that field, unfortunately.

Manually updating the database obviously not solving the underlying problem though.

Do you also have this site in a local environment? Is the same thing happening there? I'm still stumped as to what's actually happening here. I'd like to track what's going on here.

johnfmorton commented 5 years ago

I also wonder if this is related to this user being authenticated only or does this affect all Instagram accounts.

DaroldFletcher commented 5 years ago

The issue is happening in my local environment. That is where I updated the auth file to get the actual authentication information. I've tried with a couple of Instagram accounts with different craft users accounts, so it doesn't seem to be confined to a specific user or Instagram account.

The developer that added the first account is no longer around. It was before the upgrade to Craft 3, obviously using a previous version of pic puller. I may need to reach out to him to see if he had a similar issue.

johnfmorton commented 5 years ago

Maybe send me an email and we can go back and forth and figure it out.

Your early error still interests me.

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
auth:231 I heard back from the post action1

That makes me wonder if the action expecting the post data just isn't working at all. I don't know why that would be though.

johnfmorton commented 5 years ago

Another thought based on you having updated this from Craft 2 to Craft 3...

On your local environment (with a database backup) can you uninstall Pic Puller completely and then reinstall?

DaroldFletcher commented 5 years ago

Inserting the record directly into the table seems to work, even though the uid=0. I'm not sure what that does.

However, to your point, this is a workaround and the real issue should be addressed. I'll send you an email later today so we can figure it out.

DaroldFletcher commented 5 years ago

Hi John,

I just wanted to follow-up with you. I have uninstalled and reinstalled the plug-in and it seems to be working fine now. I'm not sure what happened, but all is well.

Thanks,

Darold

johnfmorton commented 5 years ago

Thanks for the follow-up, Darold.