Need some help on Twitch API as a whole for IDGB

Hi, I’m actually really unsure how to go about this. I am working on a Project that requires to connect to an API. But I want to connect to IDGB, and do something like display games of a certain console or maybe display top 100 games. I have the Client ID and Client Secret, do I need anything else, and a lot of the code that I’m seeing isn’t making any sense on how I can display what I’m looking for over here on how I’ll be able to connect:

Any explanations on it or help would be greatly appreciated, thank you. :slight_smile:

IGDB requires the use of an “App Access Token” also know as “Client Credentials token”

Once you have that, then away you go with IGDB’s API.

You might have some difficult with “top 100” as IGDB doesn’t really do “rankings”

1 Like

Hi, thanks for the input! I do apologize if I sound very inexperienced on this, but what do I use to run the sample request to get the token? I’m unsure what to use for this:

POST https://id.twitch.tv/oauth2/token?client_id=uo6dggojyb8d6soh92zknwmi5ej1q2&client_secret=nyo51xcdrerl8z9m56w9w6wg&grant_type=client_credentials
``` This isn't mine, this is from the page that you linked me to.

What you hjave copy/pasted is the “cURL example” of the call.

This should be translatable into however $languageYouUse makes HTTP/API calls.

I have written a PHP, NodeJS and Python example at https://github.com/BarryCarlyon/twitch_misc/tree/master/authentication/app_access_tokens

1 Like

This helped a lot, thank you! Alright, I managed to get the key, how would I be able to connect to parts of the code using those keys? For example, I’m using the video game bit right here in Ruby:


I would need to put the keys in the beginning(Client ID and Authorization, aka Access Token), so they look something like this? :
Client_ID = My Client ID
Authorization = Bearer + Access Token
insert the code below
I’m trying it and keeps going like request, start, do start and doesn’t display anything, As in, these are errors.

Then you need to revise your ruby code to provide more inforation about what it’s doing and any response it gets

1 Like

It’s the one from the IGDB itself, something like this:

require 'net/https'
http = Net::HTTP.new('api.igdb.com/v4',443)
http.use_ssl = true
request = Net::HTTP::Post.new(URI('https://api.igdb.com/v4/games'), {'Client-ID' => 'Client ID', 'Authorization' => 'Bearer access_token'})
request.body = 'fields age_ratings,aggregated_rating,aggregated_rating_count,alternative_names,artworks,bundles,category,checksum,collection,cover,created_at,dlcs,expansions,external_games,first_release_date,follows,franchise,franchises,game_engines,game_modes,genres,hypes,involved_companies,keywords,multiplayer_modes,name,parent_game,platforms,player_perspectives,rating,rating_count,release_dates,screenshots,similar_games,slug,standalone_expansions,status,storyline,summary,tags,themes,total_rating,total_rating_count,updated_at,url,version_parent,version_title,videos,websites;'
puts http.request(request).body

I’m not too sure what’s wrong with it, since I have the keys in it and it should connect.

Then you need to revise your ruby code to return more information.

Such as the HTTP Code and the Response body.

The example code is likely pretty basic, and I don’t know ruby.