Hi, can i ge the access token with the log in credential passed by php script? i cant find anythying on the offical api guide.
?usernamme=<your client user>
&passwordt=<your client pass>
or somiliar and get a access tokken?
and the access token can never expire??
Short answer no. The token is retrieved based on Twitch receiving the request from your application with your Client ID and Client Secret. This is essentially how OAUTH works - one important piece is never passing the password/account information for the person that you which to receive a token for.
The tokens do expire, based on their documentation. You will need to look at storing the refresh token and taking the appropriate action or requiring re-authentication as needed.
so even though i have a password and userbname of account, i still need tto let the permission by loggin it (manually) and then get the access token that expire ?
i have this code for get the token
$ch = curl_init("https://id.twitch.tv/oauth2/authorize?client_id=ea5edl3aletwqktirdeva92z47ge4m&redirect_uri=http://localhost&response_type=code";
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
but is not prin ting it
That will not print a token. The OAUTH2 flow (which is demonstrated on Twitch’s site) requires you to request the authorization which opens a web browser window, owned by Twitch, which authenticates the user, and then that page redirects the user back to the authentication page that you defined when you defined your application which then has to either retrieve the data from the body of the JSON message or from the URL (depending upon what type of token you request).
okey i added
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
but still without nothing, i will search the curl doc, ty anyway!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.