-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Unity on Windows not well supported #2305
Comments
MSAL now has support for WAM on its UWP target. Can that be used? See https://aka.ms/msal-net-wam for details and a sample. |
I was unaware of this newer feature so I tried it out. I started testing with 4.24, Unity doesn't support net461 so we are unable to use this feature in editor in Standalone builds. We've worked around this limitation by developing a native dll that we then pinvoke our exported functions to handle the WAM flow. When using vanilla MSAL in Unity Editor on this version we see:
We do not see this in 4.11 our current LKG. This type of issue is similar to the kinds of issues we encounter trying to consume MSAL; #2304 is another such issue. When I use
and then compile and deploy the UWP application we still get errors right away:
Unity can support a lot of .net stuff but care needs to be taken on which platform features are used and how their implementations are provided. |
// The MSAL Public client app // private static string MSGraphURL = "https://graph.microsoft.com/v1.0/";
This is my code and I have a couple of Questions:
"JsonSerializationException: Unable to find a constructor to use for type Microsoft.Identity.Client.Instance.Discovery.InstanceDiscoveryResponse. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'tenant_discovery_endpoint', line 1, position 29." I need help regarding the Azure AD login and API Authentication, any help would be highly appreciated @najadojo were you able to solve this? |
I am not targeting the Hololens but UWP Desktop. I have added the following lines to the Assets/Links.xml: The error still persists. |
See also #2343, which is in progress |
@pmaytak @bgavrilMS : I believe we can mark this one as Fixed ? |
@jmprieur Yes, I think so. |
Thanks for confirming @pmaytak |
I wouldn't consider this issue resolved as there are still several items that I would like solutions for:
|
net45 is almost out of support and you should consider using net461 target. I can remove the usage of
If you want to provide a different mechanism for opening a browser and reading the auth code, you can - use ICustomWebUi extensibiliy - see https://docs.microsoft.com/en-us/dotnet/api/microsoft.identity.client.extensibility.icustomwebui?view=azure-dotnet System browser or WAM should be usable via Mono. |
@bgavrilMS , I tried 4.29 today to see if the Sha256Cng/il2cpp problem has been resolved, and I can no longer get Microsoft.Identity.Client working in the unity editor (so I didn't make it far enough to test il2cpp). Current error is: NotImplementedException: The method or operation is not implemented. I know this issue is marked as closed, but the core problem seems to have gotten worse. Would you like me to open a new issue? |
Actually, looking at the code, I see:
I'll try building and testing on latest. Issue following up on the latest here for reference: |
We should release MSAL 4.30 with this change in the next few days. |
@bgavrilMS FYI, I pulled the repo and built myself. The above issue was resolved, which got things working in editor again, but it still did not work in il2cpp builds. For that, I had to remove the HAVE_CAD define, otherwise the NewtonSoft code would return DynamicCodeGeneration as true and fail at runtime. After removing that, everything works, and I'm unblocked for now, but it may be good to take a look at that. The NewtonSoft-For-Unity project (which I saw referenced in the identity code and does work out of the box) had that define disabled as well. And thanks for following up with all of this! |
Is your feature request related to a problem? Please describe.
Windows Unity support missing suggests that Unity on Windows isn't well tested.
Describe the solution you'd like
I'd like to see sample code that uses Unity on Windows (both UWP and Standalone).
Describe alternatives you've considered
Using WAM in these places is possible but the API is much more complicated to use and isn't as well supported as MSAL. For example api-version 2.0 isn't used by default.
Additional context
Unity is one of the most popular game engines and uses .net as its scripting framework. Applications that wish to use Microsoft Identity struggle with MSAL issues.
The text was updated successfully, but these errors were encountered: