Get access tokken with login in credentials?

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");
print_r(curl_exec($ch));
curl_close($ch);

but is not prin ting it