You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require(clientId !=null&& clientSecret !=null&& redirectUri !=null) { "You need to specify a valid clientId, clientSecret, and redirectUri in the credentials block!" }
804
801
@@ -828,7 +825,6 @@ class SpotifyClientApiBuilder(
828
825
options.automaticRefresh,
829
826
options.retryWhenRateLimited,
830
827
options.enableLogger,
831
-
options.testTokenValidity,
832
828
options.defaultLimit,
833
829
options.allowBulkRequests,
834
830
options.requestTimeoutMillis,
@@ -844,7 +840,7 @@ class SpotifyClientApiBuilder(
844
840
throwSpotifyException.AuthenticationException("Invalid credentials provided in the login process (clientId=$clientId, clientSecret=$clientSecret, authCode=${authorization.authorizationCode})", e)
require(clientId !=null&& redirectUri !=null) { "You need to specify a valid clientId, clientSecret, and redirectUri in the credentials block!" }
843
+
require(clientId !=null&& redirectUri !=null) { "You need to specify a valid clientId and redirectUri in the credentials block!" }
848
844
849
845
val response =HttpConnection(
850
846
"https://accounts.spotify.com/api/token",
@@ -872,7 +868,6 @@ class SpotifyClientApiBuilder(
872
868
options.automaticRefresh,
873
869
options.retryWhenRateLimited,
874
870
options.enableLogger,
875
-
options.testTokenValidity,
876
871
options.defaultLimit,
877
872
options.allowBulkRequests,
878
873
options.requestTimeoutMillis,
@@ -897,7 +892,6 @@ class SpotifyClientApiBuilder(
897
892
options.automaticRefresh,
898
893
options.retryWhenRateLimited,
899
894
options.enableLogger,
900
-
options.testTokenValidity,
901
895
options.defaultLimit,
902
896
options.allowBulkRequests,
903
897
options.requestTimeoutMillis,
@@ -923,7 +917,6 @@ class SpotifyClientApiBuilder(
923
917
false,
924
918
options.retryWhenRateLimited,
925
919
options.enableLogger,
926
-
options.testTokenValidity,
927
920
options.defaultLimit,
928
921
options.allowBulkRequests,
929
922
options.requestTimeoutMillis,
@@ -938,6 +931,10 @@ class SpotifyClientApiBuilder(
938
931
"to build a SpotifyClientApi object"
939
932
)
940
933
}
934
+
935
+
if (options.testTokenValidity) SpotifyApi.testTokenValidity(api)
936
+
937
+
return api
941
938
}
942
939
}
943
940
@@ -961,7 +958,8 @@ class SpotifyAppApiBuilder(
961
958
val clientId = credentials.clientId
962
959
val clientSecret = credentials.clientSecret
963
960
require((clientId !=null&& clientSecret !=null) || authorization.token !=null|| authorization.tokenString !=null) { "You didn't specify a client id or client secret in the credentials block!" }
964
-
returnwhen {
961
+
962
+
val api =when {
965
963
authorization.token !=null->SpotifyAppApi(
966
964
clientId,
967
965
clientSecret,
@@ -971,7 +969,6 @@ class SpotifyAppApiBuilder(
971
969
options.automaticRefresh,
972
970
options.retryWhenRateLimited,
973
971
options.enableLogger,
974
-
options.testTokenValidity,
975
972
options.defaultLimit,
976
973
options.allowBulkRequests,
977
974
options.requestTimeoutMillis,
@@ -993,7 +990,6 @@ class SpotifyAppApiBuilder(
993
990
options.automaticRefresh,
994
991
options.retryWhenRateLimited,
995
992
options.enableLogger,
996
-
options.testTokenValidity,
997
993
options.defaultLimit,
998
994
options.allowBulkRequests,
999
995
options.requestTimeoutMillis,
@@ -1013,7 +1009,6 @@ class SpotifyAppApiBuilder(
1013
1009
options.automaticRefresh,
1014
1010
options.retryWhenRateLimited,
1015
1011
options.enableLogger,
1016
-
options.testTokenValidity,
1017
1012
options.defaultLimit,
1018
1013
options.allowBulkRequests,
1019
1014
options.requestTimeoutMillis,
@@ -1035,7 +1030,6 @@ class SpotifyAppApiBuilder(
1035
1030
options.automaticRefresh,
1036
1031
options.retryWhenRateLimited,
1037
1032
options.enableLogger,
1038
-
options.testTokenValidity,
1039
1033
options.defaultLimit,
1040
1034
options.allowBulkRequests,
1041
1035
options.requestTimeoutMillis,
@@ -1050,6 +1044,10 @@ class SpotifyAppApiBuilder(
1050
1044
throwSpotifyException.AuthenticationException("Invalid credentials provided in the login process (clientId=$clientId, clientSecret=$clientSecret)", e)
1051
1045
}
1052
1046
}
1047
+
1048
+
if (options.testTokenValidity) SpotifyApi.testTokenValidity(api)
0 commit comments