How do i add a "Login with Twitch" button to my website?

Hi everyone, i would like to add a login with Twitch button to my website because i need to store in my DB the twitch id and username of the person who’s logging in.

I tried following the guides for the API but probably i’m not smart enough to make it work.

Any help is appreciated!


1 Like

Making a link to create a login button is really simple.

All you need to do is make a link on your webpage/app

‹a href=“[YOUR_PUBLIC_CLIENT_ID]&redirect_uri=[RETURN_URL]&scope=[SCOPES_REQUIRES]”›Connect With Twitch!‹/a›

Once the user clicks the link they goto Twitch. After they approve it redirect back the RETURN_URL you specified and you can process details such as auth key and run futher API calls using it as reference.

Thanks for the answer but i still can’t make it work, that’s what i get as response: {“error”:“Bad Request”,“status”:400,“message”:“No client id specified”}

Goto scroll to the bottom and click Register your application.

Give it all the requested details and you will get back your client ids

I did it. that’s the line modified :[wds8du7dz7ub3l76bx4bbjrrkuldng]&redirect_uri=[http://localhost/twitchapp/index.php]&scope=[user_read]

And it’s still not working, don’t know if i’m doing something wrong

Ahh, remove the [ and ] example:

Oh! it’s finally working!!!

Thanks a lot dude!

I just need to figure out how to get the parameters that i need after the login, how can i do that?

That all depends on what code you are using to create your page. Javascript, PHP, etc. Each code will have different methods to retrieve the parameters. It looks like you are using PHP from your sample URL. The best option would be to google it, as retrieving parameters are global across PHP, it isn’t specific to Twitch’s API.

i figured out how to retrieve the data with JS but i’ve no idea about how can i store that data in a DB.

Could someone help?

Thanks in advance

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.