@@ -88,7 +88,9 @@ func (c *Static) Token(ctx context.Context) (token string, err error) {
8888 )
8989 }
9090 defer cc .Close ()
91+
9192 client := Ydb_Auth_V1 .NewAuthServiceClient (cc )
93+
9294 response , err := client .Login (ctx , & Ydb_Auth.LoginRequest {
9395 OperationParams : & Ydb_Operations.OperationParams {
9496 OperationMode : 0 ,
@@ -103,6 +105,7 @@ func (c *Static) Token(ctx context.Context) (token string, err error) {
103105 if err != nil {
104106 return "" , xerrors .WithStackTrace (err )
105107 }
108+
106109 switch {
107110 case ! response .GetOperation ().GetReady ():
108111 return "" , xerrors .WithStackTrace (
@@ -111,6 +114,7 @@ func (c *Static) Token(ctx context.Context) (token string, err error) {
111114 response .GetOperation ().GetIssues (),
112115 ),
113116 )
117+
114118 case response .GetOperation ().GetStatus () != Ydb .StatusIds_SUCCESS :
115119 return "" , xerrors .WithStackTrace (
116120 xerrors .Operation (
@@ -123,10 +127,12 @@ func (c *Static) Token(ctx context.Context) (token string, err error) {
123127 if err = response .GetOperation ().GetResult ().UnmarshalTo (& result ); err != nil {
124128 return "" , xerrors .WithStackTrace (err )
125129 }
130+
126131 expiresAt , err := parseExpiresAt (result .GetToken ())
127132 if err != nil {
128133 return "" , xerrors .WithStackTrace (err )
129134 }
135+
130136 c .requestAt = time .Now ().Add (time .Until (expiresAt ) / TokenRefreshDivisor )
131137 c .token = result .GetToken ()
132138
0 commit comments