supabase / gotrue-dart

A dart client library for GoTrue.
MIT License
46 stars 37 forks source link

feat: add providerRefreshToken to session #118

Closed Quatton closed 1 year ago

Quatton commented 1 year ago

In response to a recent issue supabase/supabase-flutter#342 I opened, session does not contain provider_refresh_token despite the authResponse having one.

Now, the session should contain provider_refresh_token (if there is).

Also, the reason provider_token turns null after Supabase refreshes token does not depend on the parsing issue, but rather that the authResponse no longer contains both provider_token and provider_refresh_token. Therefore, I was not able to set automatic refresh token for provider as well.

Vinzent03 commented 1 year ago

Thanks for your contribution! I'm not really familiar with provider refresh tokens. E.g. which provider have them? Could you please add a test in test/provider_test.dart?

Quatton commented 1 year ago

Hello! I was running the test and got this error. What do they mean, and how could I get the tests passed?

To run this test again: C:\tools\dart-sdk\bin\dart.exe test test/provider_test.dart -p vm --plain-name "getSessionFromUrl() parse provider callback url with fragment"
00:06 +2 -2: getSessionFromUrl() parse provider callback url with fragment and query [E]
  The remote computer refused the network connection.

  package:http/src/io_client.dart 88:7     IOClient.send
  ===== asynchronous gap ===========================
  package:http/src/base_client.dart 93:32  BaseClient._sendUnstreamed
  ===== asynchronous gap ===========================
  package:http/http.dart 164:12            _withClient
  ===== asynchronous gap ===========================
  test\provider_test.dart 55:19            main.<fn>.<fn>
Vinzent03 commented 1 year ago

The tests need a local Supabase/GoTrue instance running. You need docker installed and run docker-compose up -d in the infra directory. Alternatively, you can write them and push the code so that it can be run here.

Quatton commented 1 year ago

I have already added and run all the tests! Also, I have fixed some consistency between test sets, including potential typos. How do you think about that?

Vinzent03 commented 1 year ago

LGTM! Thanks to you for the great work.