Hey there,
If you’d like to use the authorization code flow and also receive an ID token, please make sure to include the openid scope (you can include any additional scopes you need, just make sure openid is one of them) and make sure to include id_token in the response type (this means you’ll pass both id_token and code). As an example:
GET https://id.twitch.tv/oauth2/authorize?
client_id=<your client id>&
scope=openid+<your scope>+<another scope>&
response_type=id_token+code
Unfortunately, the ID token must be included in the redirect URI as a URL fragment instead of the query string per the OIDC spec: http://openid.net/specs/openid-connect-core-1_0.html#OAuth.Responses.
Also, if you’re using https://id.twitch.tv/oauth2/authorize to initiate the OAuth flow, please remember the corresponding token exchange endpoint is https://id.twitch.tv/oauth2/token, not https://api.twitch.tv/api/oauth2/token