How to connect to the pubsub-javascript-sample

Hi there ! :slight_smile:

I try to connect the pubsub javascript application, that can be found here :

So I saw that there is a clientID and a redirect URI to put. So I think that you can get those in this page : https://dev.twitch.tv/console/apps
And then all we have to do is to create a new application.

So that’s what I did, but first of all I don’t understand which redirectURI to put, so I search a solution and someone said that we can put this url : https://twitchapps.com/tokengen/
I don’t know if it works.

Anyway, I get the clientID, so I put this one into the “clientID” variable of the main.js file.
Then, on the index.html file that I have open in a browser, I click on the image button (the image doesn’t exist apparently), and I have this response that pops out of my brower :

{"status":400,"message":"invalid client"}`

Is there anything that I did wrong ? Can you explain me how to connect with success ?

Thank you so much for your help ! :slight_smile:

The redirect URI would be the URI when your oAuth handler lives.

https://twitchapps.com/tokengen/ is not yours.

For this example, it’s designed to run in a browser
So the Redirect URI for testing this example is the URL to the page that you view the page at in a Web browser.

This example doesn’t use a index.php you sure you have the right files?

Yeah thise nice “login with twtich button” images are looooong gone…

This suggests you copy and pasted your ClientID wrong.

Ok that’s what I was thinking, so is it possible to host the page and put a localhost url ? I tried to put a virtualhost that I have created with wampserver (http://twitch.pubsub), but after completing the input, it throw an error and say that the URL must be with https. Do I have to put only localhost and the full path to the file ?

Hum, index.html sorry, I used work with php file so it’s a bad habit to say that.

I copy and paste perfectly, and I did it 3 times, but it doesn’t work. Maybe I have to try one more time :slight_smile:

Thank you so much for your help :slight_smile:

Yes

For not localhost. HTTPS is enforced for redirectURI’s

Make sure you are grabbing this one

Okay everything works fine, and if I wan to listen to follows, the user:edit:follows scope is right ?

PubSub doesn’t provide a topic for follows

This scope grants access to create/delete follows.

Follows is public data and doesn’t require a scope

As per your other post

You can see as per https://dev.twitch.tv/docs/api/reference#get-users-follows that no scope is required.

Ok well thank you, I will check it out, thank you so much for your help and your time :slight_smile: