mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-08 16:20:02 +00:00
[core] Fix: Properly handle channels without credentials
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
eec4966b82
commit
3ac5284583
1 changed files with 7 additions and 0 deletions
|
@ -172,6 +172,13 @@ func (s Service) GetTwitchClientForChannel(channel string, cfg ClientConfig) (*t
|
||||||
return nil, errors.Wrap(err, "decrypting refresh token")
|
return nil, errors.Wrap(err, "decrypting refresh token")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if perm.AccessToken == "" && perm.RefreshToken == "" {
|
||||||
|
// We have no tokens but an entry in the permission table: Means
|
||||||
|
// we still can't do stuff on behalf of that channel so we treat
|
||||||
|
// that as an unauthorized channel
|
||||||
|
return nil, ErrChannelNotAuthorized
|
||||||
|
}
|
||||||
|
|
||||||
scopes := strings.Split(perm.Scopes, " ")
|
scopes := strings.Split(perm.Scopes, " ")
|
||||||
|
|
||||||
tc := twitch.New(cfg.TwitchClient, cfg.TwitchClientSecret, perm.AccessToken, perm.RefreshToken)
|
tc := twitch.New(cfg.TwitchClient, cfg.TwitchClientSecret, perm.AccessToken, perm.RefreshToken)
|
||||||
|
|
Loading…
Reference in a new issue