Dymantic / laravel-instagram-feed

147 stars 51 forks source link

Call to undefined method #42

Closed ateequrrahman97 closed 2 years ago

ateequrrahman97 commented 2 years ago

Screenshot from 2021-10-05 13-18-06 @michaeljoyner

michaeljoyner commented 2 years ago

Hi @ateequrrahman97 can I ask which version you are using?

ateequrrahman97 commented 2 years ago

Hi @ateequrrahman97 can I ask which version you are using?

"laravel/framework": "^7.24", "dymantic/laravel-instagram-feed": "^2.6",

michaeljoyner commented 2 years ago

Thanks. Sorry, I make a mistake in the tutorial, if that was what you were following. You can try do:

$profile = \Dymantic\InstagramFeed\Profile::where('username', 'event_scape')->get()->first()

ateequrrahman97 commented 2 years ago

Thanks. Sorry, I make a mistake in the tutorial, if that was what you were following. You can try do:

$profile = \Dymantic\InstagramFeed\Profile::where('username', 'event_scape')->get()->first()

Thanks, now it's working.

ateequrrahman97 commented 2 years ago

My access_code was not saved in the database. I am using ngrok for HTTPS Auth URL is working fine and redirect to not found but access_code was not saved and feed is getting empty array. If you please guide me? @michaeljoyner

michaeljoyner commented 2 years ago

What url does it redirect to?

ateequrrahman97 commented 2 years ago

What url does it redirect to?

https://2fb4-202-163-123-230.ngrok.io/instagram/auth/callback?code=AQDJNxTKR28HnronMXkyntwT3mZOTRjWtV0CbSpxlw5kHbCFqS6sInc2X4BDcyQ3s7bAtRL5jgYKi0yF-MZWBBxWLy0dtMlcvVZEqWgt2bAYei-IChbe0Snnw4cmyVsW8kQFNlnSkutNgPxrVnnwnSCxvxbowZBTKSbL4PojMqzm3wAsg2yqHXaa-CDR2qkhoX35RiBAs39alvTA11REdHw22S1kjBTjXlf2tbtiYhdMbA&state=1#_

michaeljoyner commented 2 years ago

And when you get redirected to the not found page, what is in the url?

ateequrrahman97 commented 2 years ago

And when you get redirected to the not found page, what is in the url? This URL I use to authenticate https://api.instagram.com/oauth/authorize/?client_id=2664228980539775&redirect_uri=https://2fb4-202-163-123-230.ngrok.io/instagram/auth/callback&scope=user_profile,user_media&response_type=code&state=1

And this is the redirected not found URL after authentication https://2fb4-202-163-123-230.ngrok.io/instagram/auth/callback?code=AQDJNxTKR28HnronMXkyntwT3mZOTRjWtV0CbSpxlw5kHbCFqS6sInc2X4BDcyQ3s7bAtRL5jgYKi0yF-MZWBBxWLy0dtMlcvVZEqWgt2bAYei-IChbe0Snnw4cmyVsW8kQFNlnSkutNgPxrVnnwnSCxvxbowZBTKSbL4PojMqzm3wAsg2yqHXaa-CDR2qkhoX35RiBAs39alvTA11REdHw22S1kjBTjXlf2tbtiYhdMbA&state=1#_

michaeljoyner commented 2 years ago

Can you show me your config file? Also, I'll be gone for a while, but I'll be back later

ateequrrahman97 commented 2 years ago

Can you show me your config file? Also, I'll be gone for a while, but I'll be back later Okay. Please look into it when you are back.

`<?php

return [ /*

`'auth_callback_route' => 'instagram/auth/callback',

/*
 * On success of the OAuth process you will be redirected to this route.
 * You may use query strings to carry messages
 */
'success_redirect_to' => 'instagram-auth-success',

/*
 * If the OAuth process fails for some reason you will be redirected to this route.
 * You may use query strings to carry messages
 */
'failure_redirect_to' => 'instagram-auth-failure',`

but then access_code was not saved then I have done in this way

`'auth_callback_route' => 'https://2fb4-202-163-123-230.ngrok.io/instagram/auth/callback',

/*
 * On success of the OAuth process you will be redirected to this route.
 * You may use query strings to carry messages
 */
'success_redirect_to' => 'https://2fb4-202-163-123-230.ngrok.io/instagram-auth-success',

/*
 * If the OAuth process fails for some reason you will be redirected to this route.
 * You may use query strings to carry messages
 */
'failure_redirect_to' => 'https://2fb4-202-163-123-230.ngrok.io/instagram-auth-failure',`

Byt getting the same result.
michaeljoyner commented 2 years ago

The routes in your config file shouldn't have the domain part in them. Can you change back to that and send me a screenshot of what happens after you accept the sith request on Instagram?

michaeljoyner commented 2 years ago

Sorry, forgot to mention that you can also add the ngrok domain as the base_url in your config file

ateequrrahman97 commented 2 years ago

Sorry, forgot to mention that you can also add the ngrok domain as the base_url in your config file

Thank you @michaeljoyner for giving me your attention. It is working by putting a base URL. Thanks.

michaeljoyner commented 2 years ago

It's a pleasure, I'm glad you got it working.