Git Product home page Git Product logo

Comments (9)

marcreichel avatar marcreichel commented on June 30, 2024 1

Wow! Interesting to know!
Thank you for clarifying! Using a hash prefix (or suffix) is a good idea to solve this issue. I'll leave this issue open as a reminder for myself to implement this 👍🏼

Thank you!

from igdb-laravel.

marcreichel avatar marcreichel commented on June 30, 2024

Hi @adzay,

this is weird indeed as it is working just normally over here.

The bearer token does not get updated automatically by updating your client secret but the token is cached for the token lifetime (expires_in). So when your token expires (or by running php artisan cache:forget igdb_cache.access_token) the next time you query something a fresh access token is retrieved automatically (using your new client secret).

The webhook url responded with: 405 leads me into the direction something is not working properly for how you registered the webhook url inside your application. As you might know prior to v3 of this package you needed to create a URL to handle the webhook yourself. So you may have registered it as as GET url as the 405 error states the method it called (POST) is not allowed.
When upgrading to v3 of this package the url registration is done automatically (but you may need to re-create your webhooks as the handling url has changed). The new automatically registered url is /igdb-webhook/handle/{endpoint}/{method} as you may see when running php artisan route:list.

I hope this helps. Just let me know if we may need to dig a little deeper.

from igdb-laravel.

adzay avatar adzay commented on June 30, 2024

Hi,

I have igdb-webhook/handle/{model}/{method} in my route:list so that is working fine. I deleted via composer, re added and republished the config too. Also my App_URL has my live website url. Which is why after i followed your instructions last week it worked perfectly. But now i feel i am back to square one lol.

I tried your advice on the cache and it still doesnt work via CLI.
Screenshot 2021-11-06 at 20 26 13

I put Game::createWebhook(Method::UPDATE); in my homepage controller, and that does nothing too. lol i am very confused :S.

Edit: This is also the same on the live website, not just local. The commands do nothing.

from igdb-laravel.

marcreichel avatar marcreichel commented on June 30, 2024

Hm, weird.

When you got the Error sending test JSON, Webhook url responded with: 405 error from testing the webhook, did anything got logged into your storage/logs/laravel.log?

from igdb-laravel.

adzay avatar adzay commented on June 30, 2024

Hi, Nothing in my logs at all

from igdb-laravel.

marcreichel avatar marcreichel commented on June 30, 2024

Well, now I'm confused as well 😅

May I ask you to create a fresh Laravel app, install the package and try registering a webhook over there? Just to make sure, there isn't something broken inside your real app.

from igdb-laravel.

marcreichel avatar marcreichel commented on June 30, 2024

You may bring your local test application online using https://expose.dev/ (Just make sure you enter the random url you got into your APP_URL).

from igdb-laravel.

adzay avatar adzay commented on June 30, 2024

Hi I think i figured it out. So the issue is due to me changing my Twitch client key/secret (lets not go into why lol).

It looks like if the twitch client id is changed the same webhook path handle cannot be used unless you delete the original.

For example this package submitted the below url initially to register the webhook:
https://website.com/igdb-webhook/handle/games/update

After changing my Twitch id, i tried to create another webhook with the new credentioals. But the same url above was submitted. IGDB found that URL, but it had the OLD twitch id. This is why your package couldn't see/create any new webhooks.

A bit messy for me to explain but i fixed it by adding a prefix to the webhook handle
'webhook_path' => 'igdb-webhook/handle',
'webhook_path' => 'new-igdb-webhook/handle',

Obviously it may not be often someone changes their twitch id like me, but to automate, maybe you could look into generating a 6-8 letter hashID from the twich_client_id and adding it to the front of the webhook handle.

from igdb-laravel.

marcreichel avatar marcreichel commented on June 30, 2024

@adzay Sooo, I've just released v3.3.0 which adds the hashed client_id as a suffix to igdb.webhook_path. So the new URL is https://example.com/igdb-webhook/handle/d41d8cd9/games/update for example. The old URL without the hash remains supported but is "marked" as deprecated and will be removed in the next major release. Otherwise this release would have been a breaking change.
So in order to be ready for v4 you may recreate your webhooks now so they get generated with the new hash "syntax".

Thank you again for pointing this out! I really appreciate it!

from igdb-laravel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.