-
Notifications
You must be signed in to change notification settings - Fork 214
NullReferenceException in AuthenticationContinuationHelper on Xamarin.Android #1000
Comments
@gameleon-dev Also, based on the sample code you provided, it looks like you are waiting for multiple activities to be returned. If so, you will need to designate a |
@jennyf19 Normally I handle activity results this way. But the activities launched by ADAL are not provided with a request code. They are defaulted to 0 or "no request code", with the exception of the broker activity which is hardcoded to use 1001. See the following pieces of code in the ADAL source code: Webview activity call with 0 request code. Broker activity call with 1001 request code. If there currently is no way to easily check the origin of a |
I have created a pull request that implements request codes as optional properties provided to the |
Thanks for the additional information and PR, @gameleon-dev - much appreciated. We'll take a look at your PR and do validation on our end. cc: @henrik-me @SomkaPe |
@gameleon-dev for the change you proposed. Isn't there a way for you to do the same just outside of the library code?The request code is 1001 for broker but 0 for the webui code. We could potentially change the request code used in the WebUI code to something other than 0 (however I do not know who might have taken a dependency on this). My suggestion is if you can ensure your own app doesn't use either 0 nor 1001 for requestcode then you could validate that? |
@henrik-me Checking for 0 and 1001 does work and is what I have currently implemented in code. So this issue can technically be considered closed. That said, the changes in the PR were proposed because my main concern with the current solution is that it doesn't seem optimal for long-term. Considering 0 is the default value of requestCode and the solution gives the developer limited control of their application flow. Changing the request code from 0 to another greater-than 0 value would take away the issue of overlapping with the default value, but as you stated might break existing dependencies on the value being equal to 0. (Hence why the updated constructor in PR #1001 defaults these values to the current values of 0 and 1001 as not to break existing dependencies). |
That makes sense. @jmprieur would like to hear your thoughts on this one |
Won't fix in ADAL.NET |
I'm having an issue with the ADAL library on Xamarin.Android.
I have implemented the following piece of code:
However this causes an issue whenever this method gets called when returning from a non-ADAL activity.
Judging by the source code it seems there is no check if the activity result came from an ADAL related activity or broker, and it will therefore try to parse a nonexistant uri.
Is there any way to check if a activity result came from an ADAL activity/broker, similar to the
IsBrokerResponse
method in the iOS version of this class?I already tried checking if ReturnedUrl was present in the extras bundle before calling the
SetAuthenticationAgentContinuationEventArgs
method, but it's only present if authentication went successfully, therefore making it unhelpful in case errors need to be handled by ADAL.The text was updated successfully, but these errors were encountered: