You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
Which Version of ADAL are you using ?
5.0.2-preview
Which platform has the issue?
Xamarin.Android
What authentication flow has the issue?
Desktop / Mobile
[*] Interactive
[*] Token renewal
Is this a new or existing app?
The app is in production, and I have upgraded to a new version of ADAL
Repro
AuthenticationContextctx=newAuthenticationContext(endpoint,false,TokenCache.DefaultShared,newHttpClientFactory());return(awaitctx.AcquireTokenSilentAsync(resource,clientId)).AccessToken;publicclassHttpClientFactory:IHttpClientFactory{publicHttpClientGetHttpClient(){returnnewHttpClient();//Automatically initialized with a AndroidClientHandler instead of a HttpMessageHandler due to Xamarin.Android project settings}}
Expected behavior
Any HttpClient exception getting propagated to the caller (as an InnerException to an AdalServiceException), as is default behaviour without a IHttpClientFactory instance passed to the context.
Actual behavior
Any exception seems to be ignored and the response is parsed.
Which fails due to there being no response, making the library throw up a parsing exception.
Additional context/ Logs / Screenshots
The exception that occurs when the parsing of the non-existing response fails:
System.Runtime.Serialization.SerializationException: Expecting element 'root' from namespace ''.. Encountered 'None' with name '', namespace ''.
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject (System.Runtime.Serialization.XmlReaderDelegator xmlReader, System.Boolean verifyObjectName) [0x00069] in <eddf66ae34d240a1bb39744e055a9c28>:0
at System.Runtime.Serialization.XmlObjectSerializer.InternalReadObject (System.Runtime.Serialization.XmlReaderDelegator reader, System.Boolean verifyObjectName, System.Runtime.Serialization.DataContractResolver dataContractResolver) [0x00000] in <eddf66ae34d240a1bb39744e055a9c28>:0
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions (System.Runtime.Serialization.XmlReaderDelegator reader, System.Boolean verifyObjectName, System.Runtime.Serialization.DataContractResolver dataContractResolver) [0x00072] in <eddf66ae34d240a1bb39744e055a9c28>:0
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions (System.Runtime.Serialization.XmlReaderDelegator reader, System.Boolean verifyObjectName) [0x00000] in <eddf66ae34d240a1bb39744e055a9c28>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.Xml.XmlDictionaryReader reader) [0x0000d] in <eddf66ae34d240a1bb39744e055a9c28>:0
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject (System.IO.Stream stream) [0x00017] in <eddf66ae34d240a1bb39744e055a9c28>:0
at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Helpers.EncodingHelper.DeserializeResponse[T] (System.String response) [0x00024] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Helpers\EncodingHelper.cs:247
at Microsoft.Identity.Core.OAuth2.OAuthClient+<GetResponseAsync>d__18`1[T].MoveNext () [0x000fb] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Core\OAuth2\OAuthClient.cs:63
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Identity.Core.OAuth2.OAuthClient+<GetResponseAsync>d__17`1[T].MoveNext () [0x00028] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Core\OAuth2\OAuthClient.cs:45
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.AcquireTokenHandlerBase+<SendHttpMessageAsync>d__75.MoveNext () [0x00053] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:404
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.AcquireTokenHandlerBase+<SendTokenRequestByRefreshTokenAsync>d__73.MoveNext () [0x0007f] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:345
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.AcquireTokenHandlerBase+<RefreshAccessTokenAsync>d__74.MoveNext () [0x00059] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:366
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.AcquireTokenHandlerBase+<RunAsync>d__60.MoveNext () [0x006f8] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:240
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext+<AcquireTokenSilentCommonAsync>d__43.MoveNext () [0x00084] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\AuthenticationContext.cs:625
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext+<AcquireTokenSilentAsync>d__30.MoveNext () [0x0003f] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\AuthenticationContext.cs:378
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext+<AcquireTokenSilentAsync>d__29.MoveNext () [0x00038] in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\AuthenticationContext.cs:365
--- End of stack trace from previous location where exception was thrown ---
The text was updated successfully, but these errors were encountered:
Yes, I see the regression. I believe @jennyf19 's fix will address it and I just approved the PR. We will try to get a release out as soon as possible.
Which Version of ADAL are you using ?
5.0.2-preview
Which platform has the issue?
Xamarin.Android
What authentication flow has the issue?
Is this a new or existing app?
The app is in production, and I have upgraded to a new version of ADAL
Repro
Expected behavior
Any HttpClient exception getting propagated to the caller (as an InnerException to an AdalServiceException), as is default behaviour without a IHttpClientFactory instance passed to the context.
Actual behavior
Any exception seems to be ignored and the response is parsed.
Which fails due to there being no response, making the library throw up a parsing exception.
Additional context/ Logs / Screenshots
The exception that occurs when the parsing of the non-existing response fails:
The text was updated successfully, but these errors were encountered: