-
-
Notifications
You must be signed in to change notification settings - Fork 214
fix: Added missing error codes for AuthException #995
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a73d0ae
Add auth error codes enum
lawinski a14c65f
Add error code parameter for the auth exception
lawinski f15aded
Handle error_code parameter
lawinski 08683c6
Add error_code for the getSessionFromUrl exception
lawinski d4566e8
Add basic asserts for error_codes
lawinski 4639087
Replace AuthException with AuthSessionMissingException
lawinski 28cf157
Adjust logic to JS implementation.
lawinski a267895
more alignment with the JS SDK
dshukertjr 362f682
fix: use docker compose v2
dshukertjr fc125cf
update auth server version and fix failing tests
dshukertjr dc3a709
fix failing test
dshukertjr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import 'package:gotrue/src/constants.dart'; | ||
import 'package:http/http.dart'; | ||
|
||
// Parses the API version which is 2YYY-MM-DD. */ | ||
const String _apiVersionRegex = | ||
r'^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])'; | ||
|
||
/// Represents the API versions supported by the package. | ||
|
||
/// Represents the API version specified by a [name] in the format YYYY-MM-DD. | ||
class ApiVersion { | ||
const ApiVersion({ | ||
required this.name, | ||
required this.timestamp, | ||
}); | ||
|
||
final String name; | ||
final DateTime timestamp; | ||
|
||
/// Parses the API version from the string date. | ||
static ApiVersion? fromString(String version) { | ||
if (!RegExp(_apiVersionRegex).hasMatch(version)) { | ||
return null; | ||
} | ||
|
||
final DateTime? timestamp = DateTime.tryParse('${version}T00:00:00.0Z'); | ||
if (timestamp == null) return null; | ||
return ApiVersion(name: version, timestamp: timestamp); | ||
} | ||
|
||
/// Parses the API version from the response headers. | ||
static ApiVersion? fromResponse(Response response) { | ||
final version = response.headers[Constants.apiVersionHeaderName]; | ||
return version != null ? fromString(version) : null; | ||
} | ||
|
||
/// Returns true if this version is the same or after [other]. | ||
bool isSameOrAfter(ApiVersion other) { | ||
return timestamp.isAfter(other.timestamp) || name == other.name; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.