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
Copy file name to clipboardExpand all lines: core/src/main/java/cloud/stackit/sdk/core/KeyFlowAuthenticator.java
+25-6Lines changed: 25 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -52,6 +52,10 @@ public class KeyFlowAuthenticator implements Authenticator {
52
52
/**
53
53
* Creates the initial service account and refreshes expired access token.
54
54
*
55
+
* NOTE: It's normal that 2 requests are sent, it's regular OkHttp Authenticator behavior. The first
56
+
* request is always attempted without the authenticator and in case the response is Unauthorized(=401),
57
+
* OkHttp reattempt the request with the authenticator. See <a href="https://square.github.io/okhttp/recipes/#handling-authentication-kt-java">OkHttp Docs</a>
58
+
*
55
59
* @deprecated use constructor with OkHttpClient instead to prevent resource leaks. Will be
56
60
* removed in April 2026.
57
61
* @param cfg Configuration to set a custom token endpoint and the token expiration leeway.
@@ -65,6 +69,10 @@ public KeyFlowAuthenticator(CoreConfiguration cfg, ServiceAccountKey saKey) {
65
69
/**
66
70
* Creates the initial service account and refreshes expired access token.
67
71
*
72
+
* NOTE: It's normal that 2 requests are sent, it's regular OkHttp Authenticator behavior. The first
73
+
* request is always attempted without the authenticator and in case the response is Unauthorized(=401),
74
+
* OkHttp reattempt the request with the authenticator. See <a href="https://square.github.io/okhttp/recipes/#handling-authentication-kt-java">OkHttp Docs</a>
75
+
*
68
76
* @deprecated use constructor with OkHttpClient instead to prevent resource leaks. Will be
69
77
* removed in April 2026.
70
78
* @param cfg Configuration to set a custom token endpoint and the token expiration leeway.
@@ -81,6 +89,10 @@ public KeyFlowAuthenticator(
81
89
/**
82
90
* Creates the initial service account and refreshes expired access token.
83
91
*
92
+
* NOTE: It's normal that 2 requests are sent, it's regular OkHttp Authenticator behavior. The first
93
+
* request is always attempted without the authenticator and in case the response is Unauthorized(=401),
94
+
* OkHttp reattempt the request with the authenticator. See <a href="https://square.github.io/okhttp/recipes/#handling-authentication-kt-java">OkHttp Docs</a>
95
+
*
84
96
* @param httpClient OkHttpClient object
85
97
* @param cfg Configuration to set a custom token endpoint and the token expiration leeway.
86
98
*/
@@ -89,12 +101,16 @@ public KeyFlowAuthenticator(OkHttpClient httpClient, CoreConfiguration cfg) thro
89
101
}
90
102
91
103
/**
92
-
* Creates the initial service account and refreshes expired access token.
93
-
*
94
-
* @param httpClient OkHttpClient object
95
-
* @param cfg Configuration to set a custom token endpoint and the token expiration leeway.
96
-
* @param saKey Service Account Key, which should be used for the authentication
97
-
*/
104
+
* Creates the initial service account and refreshes expired access token.
105
+
*
106
+
* NOTE: It's normal that 2 requests are sent, it's regular OkHttp Authenticator behavior. The first
107
+
* request is always attempted without the authenticator and in case the response is Unauthorized(=401),
108
+
* OkHttp reattempt the request with the authenticator. See <a href="https://square.github.io/okhttp/recipes/#handling-authentication-kt-java">OkHttp Docs</a>
109
+
*
110
+
* @param httpClient OkHttpClient object
111
+
* @param cfg Configuration to set a custom token endpoint and the token expiration leeway.
112
+
* @param saKey Service Account Key, which should be used for the authentication
0 commit comments