-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export an Authentication Error to allow type assertions (#330)
Co-authored-by: Rita Zerrizuela <[email protected]>
- Loading branch information
1 parent
1f73dd6
commit 8c3c25e
Showing
4 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 |
---|---|---|
|
@@ -51,4 +51,22 @@ | |
// authentication.WithClientSecret(secret), // Optional depending on the grants used | ||
// authentication.WithClockTolerance(10 * time.Second), | ||
// ) | ||
// | ||
// # Handling Errors | ||
// | ||
// This package exports an [authentication.Error] type that can be used to check errors | ||
// returned from the Authentication API and handle them as necessary, for example | ||
// | ||
// tokens, err := auth.OAuth.LoginWithPassword(context.Background(), oauth.LoginWithPasswordRequest{ | ||
// Username: "[email protected]", | ||
// Password: "hunter2", | ||
// }, oauth.IDTokenValidationOptions{}) | ||
// | ||
// if err != nil { | ||
// if aerr, ok := err.(*authentication.Error); ok { | ||
// if aerr.Err == "mfa_required" { | ||
// // Handle prompting for MFA usage | ||
// } | ||
// } | ||
// } | ||
package authentication |