Skip to content
Open
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
2 changes: 1 addition & 1 deletion auth/user_mgt.go
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,7 @@ func parseErrorResponse(resp *internal.Response) (string, string) {
idx := strings.Index(code, ":")
if idx != -1 {
detail = strings.TrimSpace(code[idx+1:])
code = code[:idx]
code = strings.TrimSpace(code[:idx])
}

return code, detail
Expand Down
2 changes: 1 addition & 1 deletion auth/user_mgt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,7 @@ func TestHTTPErrorWithCode(t *testing.T) {
}

func TestAuthErrorWithCodeAndDetails(t *testing.T) {
resp := []byte(`{"error":{"message":"USER_NOT_FOUND: extra details"}}`)
resp := []byte(`{"error":{"message":"USER_NOT_FOUND : extra details"}}`)
s := echoServer(resp, t)
defer s.Close()
s.Client.baseClient.httpClient.RetryConfig = nil
Expand Down
14 changes: 14 additions & 0 deletions integration/auth/user_mgt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (

const (
continueURL = "http://localhost/?a=1&b=2#c=3"
invalidContinueURL = "http://www.localhost/?a=1&b=2#c=3"
continueURLKey = "continueUrl"
oobCodeKey = "oobCode"
modeKey = "mode"
Expand Down Expand Up @@ -1297,6 +1298,19 @@ func TestEmailSignInLink(t *testing.T) {
}
}

func TestAuthErrorParse(t *testing.T) {
user := newUserWithParams(t)
defer deleteUser(user.UID)
_, err := client.EmailSignInLink(context.Background(), user.Email, &auth.ActionCodeSettings{
URL: invalidContinueURL,
HandleCodeInApp: false,
})
want := "domain of the continue url is not whitelisted: "
if err == nil || !auth.IsUnauthorizedContinueURI(err) || !strings.HasPrefix(err.Error(), want) {
t.Errorf("EmailSignInLink() expected error, got: %s, want: %s", err, want)
}
}

func resetPassword(email, oldPassword, newPassword, oobCode string) error {
req := map[string]interface{}{
"email": email,
Expand Down