@@ -176,12 +176,20 @@ export const AuthLoginCommand = cmd({
176
176
spinner . stop ( "Failed to authorize" , 1 )
177
177
}
178
178
if ( result . type === "success" ) {
179
- await Auth . set ( provider , {
180
- type : "oauth" ,
181
- refresh : result . refresh ,
182
- access : result . access ,
183
- expires : result . expires ,
184
- } )
179
+ if ( "refresh" in result ) {
180
+ await Auth . set ( provider , {
181
+ type : "oauth" ,
182
+ refresh : result . refresh ,
183
+ access : result . access ,
184
+ expires : result . expires ,
185
+ } )
186
+ }
187
+ if ( "key" in result ) {
188
+ await Auth . set ( provider , {
189
+ type : "api" ,
190
+ key : result . key ,
191
+ } )
192
+ }
185
193
spinner . stop ( "Login successful" )
186
194
}
187
195
}
@@ -197,12 +205,20 @@ export const AuthLoginCommand = cmd({
197
205
prompts . log . error ( "Failed to authorize" )
198
206
}
199
207
if ( result . type === "success" ) {
200
- await Auth . set ( provider , {
201
- type : "oauth" ,
202
- refresh : result . refresh ,
203
- access : result . access ,
204
- expires : result . expires ,
205
- } )
208
+ if ( "refresh" in result ) {
209
+ await Auth . set ( provider , {
210
+ type : "oauth" ,
211
+ refresh : result . refresh ,
212
+ access : result . access ,
213
+ expires : result . expires ,
214
+ } )
215
+ }
216
+ if ( "key" in result ) {
217
+ await Auth . set ( provider , {
218
+ type : "api" ,
219
+ key : result . key ,
220
+ } )
221
+ }
206
222
prompts . log . success ( "Login successful" )
207
223
}
208
224
}
0 commit comments