File tree Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,6 @@ jobs:
100100 name : Release
101101
102102 - name : Setup .NET Core
103- if : matrix.os == 'ubuntu-latest'
104103 uses : actions/setup-dotnet@v1
105104 with :
106105 dotnet-version : 2.2.108
Original file line number Diff line number Diff line change 1515using System ;
1616using System . Collections . Generic ;
1717using System . Linq ;
18+ using System . Net ;
1819using System . Net . Http ;
1920using System . Threading . Tasks ;
2021using FirebaseAdmin . Tests ;
@@ -321,6 +322,35 @@ public async Task SignInWithEmailLinkUnexpectedResponse()
321322 Assert . Null ( exception . InnerException ) ;
322323 }
323324
325+ [ Fact ]
326+ public async Task InvalidDynamicLinkDomain ( )
327+ {
328+ var json = $@ "{{
329+ ""error"": {{
330+ ""message"": ""INVALID_DYNAMIC_LINK_DOMAIN"",
331+ }}
332+ }}" ;
333+ var handler = new MockMessageHandler ( )
334+ {
335+ StatusCode = HttpStatusCode . InternalServerError ,
336+ Response = json ,
337+ } ;
338+ var auth = this . CreateFirebaseAuth ( handler ) ;
339+
340+ var exception = await Assert . ThrowsAsync < FirebaseAuthException > (
341+ async ( ) => await auth . GenerateSignInWithEmailLinkAsync (
342+ "user@example.com" , ActionCodeSettings ) ) ;
343+
344+ Assert . Equal ( ErrorCode . InvalidArgument , exception . ErrorCode ) ;
345+ Assert . Equal ( AuthErrorCode . InvalidDynamicLinkDomain , exception . AuthErrorCode ) ;
346+ Assert . Equal (
347+ "Dynamic link domain specified in ActionCodeSettings is not authorized "
348+ + "(INVALID_DYNAMIC_LINK_DOMAIN)." ,
349+ exception . Message ) ;
350+ Assert . NotNull ( exception . HttpResponse ) ;
351+ Assert . Null ( exception . InnerException ) ;
352+ }
353+
324354 private FirebaseAuth CreateFirebaseAuth ( HttpMessageHandler handler )
325355 {
326356 var userManager = new FirebaseUserManager ( new FirebaseUserManager . Args
Original file line number Diff line number Diff line change @@ -58,5 +58,10 @@ public enum AuthErrorCode
5858 /// No user record found for the given identifier.
5959 /// </summary>
6060 UserNotFound ,
61+
62+ /// <summary>
63+ /// Dynamic link domain specified in <see cref="ActionCodeSettings"/> is not authorized.
64+ /// </summary>
65+ InvalidDynamicLinkDomain ,
6166 }
6267}
Original file line number Diff line number Diff line change @@ -56,6 +56,13 @@ internal sealed class AuthErrorHandler
5656 AuthErrorCode . EmailAlreadyExists ,
5757 "The user with the provided email already exists" )
5858 } ,
59+ {
60+ "INVALID_DYNAMIC_LINK_DOMAIN" ,
61+ new ErrorInfo (
62+ ErrorCode . InvalidArgument ,
63+ AuthErrorCode . InvalidDynamicLinkDomain ,
64+ "Dynamic link domain specified in ActionCodeSettings is not authorized" )
65+ } ,
5966 {
6067 "PHONE_NUMBER_EXISTS" ,
6168 new ErrorInfo (
You can’t perform that action at this time.
0 commit comments