Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add error_code from url to AuthException #968

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/gotrue/lib/src/gotrue_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,9 @@ class GoTrueClient {
}

final errorDescription = url.queryParameters['error_description'];
final errorCode = url.queryParameters['error_code'];
if (errorDescription != null) {
throw AuthException(errorDescription);
throw AuthException(errorDescription, statusCode: errorCode);
}

if (_flowType == AuthFlowType.pkce) {
Expand Down
1 change: 1 addition & 0 deletions packages/gotrue/test/client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void main() {
fail('getSessionFromUrl did not throw exception');
} on AuthException catch (error) {
expect(error.message, errorMessage);
expect(error.statusCode, '401');
} catch (error) {
fail(
'getSessionFromUrl threw ${error.runtimeType} instead of AuthException');
Expand Down
Loading