Use cache instead of prefs
All checks were successful
release / release-plugins (push) Successful in 25s

This commit is contained in:
mschuepbach
2024-03-16 13:11:10 +01:00
parent 234490e2f5
commit f3debbb50a

View File

@@ -57,7 +57,7 @@ sub getToken {
if (defined $code) {
$post .= "&code=$code&grant_type=http://oauth.net/grant_type/device/1.0";
} else {
$post .= "&refresh_token=" . $prefs->get('refresh_token') . "&grant_type=refresh_token";
$post .= "&refresh_token=" . $cache->get('yt:refresh_token') . "&grant_type=refresh_token";
}
my $http = Slim::Networking::SimpleAsyncHTTP->new(
@@ -70,7 +70,7 @@ sub getToken {
$log->error($@);
} else {
$cache->set("yt:access_token", $result->{access_token}, $result->{expires_in} - 60);
$prefs->set('refresh_token', $result->{refresh_token}) if $result->{refresh_token};
$cache->set('yt:refresh_token', $result->{refresh_token}) if $result->{refresh_token};
$cache->remove('yt:user_code');
$cache->remove('yt:verification_url');