Skip to content
This repository has been archived by the owner on Jan 26, 2021. It is now read-only.

Got an error when using clientViaUserConsent client after some time #84

Open
Kleak opened this issue Nov 28, 2020 · 1 comment
Open

Comments

@Kleak
Copy link

Kleak commented Nov 28, 2020

the client i got with clientViaUserConsent give me this error after some time of use :

Unhandled exception:
HttpException: Unexpected response (unsolicited response without request).
#0      new _HttpClientConnection.<anonymous closure> (dart:_http/http_impl.dart:1812:9)
#1      _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#2      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#3      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#4      _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
#5      _StreamController._add (dart:async/stream_controller.dart:682:7)
#6      _StreamController.add (dart:async/stream_controller.dart:624:5)
#7      _HttpParser._headersEnd (dart:_http/http_parser.dart:408:17)
#8      _HttpParser._doParse (dart:_http/http_parser.dart:740:15)
#9      _HttpParser._parse (dart:_http/http_parser.dart:324:7)
#10     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#13     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
#14     _StreamController._add (dart:async/stream_controller.dart:682:7)
#15     _StreamController.add (dart:async/stream_controller.dart:624:5)
#16     _Socket._onData (dart:io-patch/socket_patch.dart:2044:41)
#17     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#18     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:357:11)
#19     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:285:7)
#20     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:808:19)
#21     _StreamController._add (dart:async/stream_controller.dart:682:7)
#22     _StreamController.add (dart:async/stream_controller.dart:624:5)
#23     _RawSecureSocket._sendReadEvent (dart:io/secure_socket.dart:1002:19)
#24     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#25     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:397:19)
#26     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
@Kleak
Copy link
Author

Kleak commented Nov 28, 2020

and if by chance i don't get this error when my token has expired i got this one :

Unhandled exception:
NoSuchMethodError: The getter 'length' was called on null.
Receiver: null
Tried calling: length
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
#1      _Uri._uriEncode (dart:core-patch/uri_patch.dart:44:23)
#2      Uri.encodeComponent (dart:core/uri.dart:1065:17)
#3      refreshCredentials (package:googleapis_auth/auth.dart:240:26)
#4      AutoRefreshingClient.send (package:googleapis_auth/src/auth_http_utils.dart:101:24)
#5      BaseClient._sendUnstreamed (package:http/src/base_client.dart:91:38)
#6      BaseClient.post (package:http/src/base_client.dart:32:7)
#7      main (file:///home/kleak/Work/github.com/Kleak/auto_backup_media/bin/auto_get_from_google_photo.dart:70:35)
<asynchronous suspension>
#8      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:301:19)
#9      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

This is because refreshToken is null but i don't know why

here is how i get the authClient

  final ioClient = IOClient();
  var authClient = await clientViaUserConsent(clientId, scopes, prompt, baseClient: ioClient);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant