mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
Updated NoTwitch to fix Scopes
This commit is contained in:
parent
51046034e4
commit
c1a91b9a6a
1 changed files with 6 additions and 4 deletions
|
@ -16,6 +16,7 @@ signal chat_received_rich(chat_dict)
|
|||
@export var redirect_port := "8000"
|
||||
|
||||
var auth_url := "https://id.twitch.tv/oauth2/authorize?response_type=token&"
|
||||
var auth_scopes : Array[String] = ["chat:read", "chat:edit", "channel:read:redemptions"]
|
||||
|
||||
var auth_server : TCPServer
|
||||
|
||||
|
@ -59,9 +60,10 @@ func cache_user_data():
|
|||
|
||||
## Handles the basic Twitch Authentication process to request and then later receive a Token (using [method check_auth_peer]).
|
||||
## Returns the authentication URL.
|
||||
func authenticate_with_twitch(client_id = client_id, scopes : Array[String] = ["chat:read", "chat:edit"]) -> String:
|
||||
func authenticate_with_twitch(client_id = client_id, scopes : Array[String] = auth_scopes) -> String:
|
||||
auth_server = TCPServer.new()
|
||||
var url := create_auth_url(scopes)
|
||||
auth_scopes = scopes
|
||||
var url := create_auth_url()
|
||||
auth_server.listen(int(redirect_port))
|
||||
return url
|
||||
|
||||
|
@ -139,11 +141,11 @@ func _process(delta):
|
|||
## [param scopes], Twitch Client ID ([param id]) and [param redirect_uri].
|
||||
## [param id] defaults to [member client_id] and both [param redirect] and
|
||||
## [param redirect_port]
|
||||
func create_auth_url(scopes : Array[String], port := redirect_port, id : String = client_id, redirect : String = redirect_uri) -> String:
|
||||
func create_auth_url(port := redirect_port, id : String = client_id, redirect : String = redirect_uri) -> String:
|
||||
|
||||
var str_scopes : String
|
||||
|
||||
for all in scopes:
|
||||
for all in auth_scopes:
|
||||
|
||||
str_scopes += " " + all
|
||||
str_scopes = str_scopes.strip_edges()
|
||||
|
|
Loading…
Reference in a new issue