Skip to content

Commit 9541603

Browse files
authored
Merge pull request #235 from yandex-cloud/fix/oauth-warning-once
Do not annoy with warnings about OAuth deprecation
2 parents a4d8fc6 + e1bd07d commit 9541603

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/session.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,19 @@ const createIamToken = async (iamEndpoint: string, req: Partial<CreateIamTokenRe
3939

4040
const newTokenCreator = (config: SessionConfig): (() => Promise<string>) => {
4141
if (isOAuth(config)) {
42+
let warned = false;
43+
4244
return () => {
4345
const iamEndpoint = getServiceClientEndpoint(IamTokenServiceClient);
4446

45-
logger.warn(
46-
'By the end of 2026 OAuthToken will be discontinued at Yandex Cloud. Please consider to use another credetials provider.',
47-
);
47+
if (!warned) {
48+
warned = true;
49+
50+
logger.warn(
51+
'By the end of 2026 OAuthToken will be discontinued at Yandex Cloud. '
52+
+ 'Please consider to use another credetials provider.',
53+
);
54+
}
4855

4956
return createIamToken(iamEndpoint, {
5057
yandexPassportOauthToken: config.oauthToken,

0 commit comments

Comments
 (0)