语言

Menu
Sites
Language
[TV] OAUTH2 Twitch

Hello, first time poster/Tizen developer here.

Looking for some help in implenting oauth2 for Twitch.

I would need to redirect a webpage to twitch login page which I am able to di using the web application framework.

However you must provide a redirect URL which will be hit and return your access token to access the API on behalf of the user.

Is there a way to handle this redirect in the Tizen web browser and capture the token?

 

Saw a couple posts regarding oauth2 on the forums but none that discussed the redirect url.

Here are some of the doc I'm looking at for Twitch oauth2.

https://github.com/justintv/Twitch-API/blob/master/authentication.md

https://github.com/justintv/Twitch-API

编辑者为: John Ixion 19 12月, 2016

响应

3 回复
Mark Watney

Hi James!

Does your webapp have a server ?

If your application has a server, the redirect uri is used to obtain a code on server side and access token can be requested using that code. Listen at the sepecified redirect uri on server side and parse the code from the reuquest.

Then, Access token can be obtained using a post request at https://api.twitch.tv/kraken/oauth2/token along with other required information. The response will be a JSON reponse. And you can route to your next page using the token.

If your application doesn't have a server, just provide that next page as 'redirect uri' and Twitch API will redirect there. It will bind that access token with the redirect URL. See step 2 of 'Implicit Grant Flow' section of 1st reference.

Thanks.

James Hoegerl

Hey Mark thank you for the reply.

I understand the concepts there with the redirect URI, but how am I able to recognize when this action is completed in Tizen world? Once I open the Twitch login page in my Tizen app how can I recognize that the login process is complete and move back to my app views/html. I understand the OAUTH2 concepts but not particularly how to apply them in a web tizen app.

 

Thanks again.

James

James Hoegerl

Or to further clarify. When having no server and living on a device. How can I provde a redirect URI that my device will respond too. I can't right? I would need a server which can store these tokens then I can use my app to retrieve them with my app is the only thing i can think of. What do you mean by "next page" in the implicit grant flow?