Gestion de l'authentification pour le access token et refresh_token

This commit is contained in:
Kepka Ludovic
2025-08-28 17:15:33 +02:00
committed by skylanix
parent 641ff40716
commit 582ea35c3c
11 changed files with 67 additions and 28 deletions

View File

@@ -18,10 +18,6 @@
<input name="twitch_client_id" type="text" value="{{ configuration.getValue('twitch_client_id') }}" />
<label for="twitch_client_secret">Client Secret</label>
<input name="twitch_client_secret" type="text" value="{{ configuration.getValue('twitch_client_secret') }}" />
<label for="twitch_access_token">Access Token</label>
<input name="twitch_access_token" type="text" value="{{ configuration.getValue('twitch_access_token') }}" />
<label for="twitch_refresh_token">Refresh Token</label>
<input name="twitch_refresh_token" type="text" value="{{ configuration.getValue('twitch_refresh_token') }}" />
<label for="twitch_channel">Chaîne à rejoindre</label>
<input name="twitch_channel" type="text" value="{{ configuration.getValue('twitch_channel') }}"
placeholder="#machinTruc" />
@@ -29,6 +25,17 @@
<p>
<a href="{{ url_for('twitchConfigurationHelp') }}">Aide</a>
</p>
{% if configuration.getValue('twitch_client_secret') and configuration.getValue('twitch_client_id') %}
<p>
<a href="{{ url_for('twitchRequestToken') }}">Obtenir token et refresh token</a>
</p>
<label for="twitch_access_token">Access Token</label>
<input name="twitch_access_token" type="text" value="{{ configuration.getValue('twitch_access_token') }}"
readonly="readonly" />
<label for="twitch_refresh_token">Refresh Token</label>
<input name="twitch_refresh_token" type="text" value="{{ configuration.getValue('twitch_refresh_token') }}"
readonly="readonly" />
{% endif %}
<p>Nécessite un redémarrage</p>
</form>

View File

@@ -3,14 +3,15 @@
{% block content %}
<h1>Procédure de configuration de Twitch</h1>
<p>
<strong>Avant toute chose, activez l'authentification à deux facteurs (2FA) :</strong>
<a href="https://help.twitch.tv/s/article/two-factor-authentication?language=en_US" target="_blank">Guide officiel Twitch pour la 2FA</a>
<strong>Avant toute chose, activez l'authentification à deux facteurs (2FA) :</strong>
<a href="https://help.twitch.tv/s/article/two-factor-authentication?language=en_US" target="_blank">Guide officiel
Twitch pour la 2FA</a>
</p>
<p>
Rendez-vous sur <a href="https://dev.twitch.tv/console" target="_blank">la console d'applications Twitch</a> et
ajoutez une application. Renseignez :
<ul>
<li>URL de redirection : https://twitchtokengenerator.com</li>
<li>URL de redirection : {{token_redirect_url}}</li>
<li>Catégorie : Chat Bot</li>
</ul>
</p>
@@ -25,25 +26,10 @@
<img src="/static/img/twitch-api-02.jpg">
<p>
Ensuite, rendez-vous sur <a href="https://twitchtokengenerator.com/" target="_blank">twitchtokengenerator.com</a> et
sélectionnez <strong>Custom Scope Target</strong>. Dans la section <strong>Use My Client Secret and Client
ID</strong>, renseignez les deux champs.
Ensuite, retourner sur la page de <a href="{{url_for('openConfigurations')}}">Configuration</a>, apres avoir
enregistret le <strong>Client ID</strong> et le <strong>Client Secret</strong>, cliquer sur le lien <strong>Obtenir
token et refresh token</strong>. Si tout se passe bien les champs <strong>Access Token</strong> et
<strong>Refresh Token</strong> sont rempli.
</p>
<img src="/static/img/twitch-api-03.jpg">
<p>
Ensuite, dans la section <strong>Available Token Scopes</strong>, cochez <em>chat:read</em> et <em>chat:edit</em>.
Puis, dans la même section, cliquez sur <strong>Generate token</strong>.
</p>
<img src="/static/img/twitch-api-04.jpg">
<p>
Suivez la procédure et vous avez votre <strong>Access Token</strong> et <strong>Refresh Token</strong>
</p>
<img src="/static/img/twitch-api-05.jpg">
{% endblock %}