WaitForAuthorization polls for user authorization and returns the auth bundle.
(ctx context.Context, deviceCode *DeviceCodeResponse)
| 63 | |
| 64 | // WaitForAuthorization polls for user authorization and returns the auth bundle. |
| 65 | func (k *KimiAuth) WaitForAuthorization(ctx context.Context, deviceCode *DeviceCodeResponse) (*KimiAuthBundle, error) { |
| 66 | tokenData, err := k.deviceClient.PollForToken(ctx, deviceCode) |
| 67 | if err != nil { |
| 68 | return nil, err |
| 69 | } |
| 70 | |
| 71 | return &KimiAuthBundle{ |
| 72 | TokenData: tokenData, |
| 73 | DeviceID: k.deviceClient.deviceID, |
| 74 | }, nil |
| 75 | } |
| 76 | |
| 77 | // CreateTokenStorage creates a new KimiTokenStorage from auth bundle. |
| 78 | func (k *KimiAuth) CreateTokenStorage(bundle *KimiAuthBundle) *KimiTokenStorage { |
no test coverage detected