Closed ViktorBergman closed 8 years ago
Yeah, I'm having the same problem, there's more in this issue
https://github.com/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/issues/3#issuecomment-242955155
The same problem on my side (Microsoft.Graph.ServiceException, Code: authenticationCancelled).
Same problem here. Completely blocking updating to the 2.0.0 package.
So, anyone knows the solution (except downgrading SDK version)? Does Microsoft know for this problem?
I'm able to reproduce locally. Investigating...
I suspect there is a packaging issue, but am having trouble verifying. Can someone that is hitting this issue check this: what version of Microsoft.IdentityModel.Clients.ActiveDirectory
do you have installed? If >3.0, can you try downgrading to 2.21.xx and try again? Please let me know the results.
Also helpful would be if someone hitting this issue were to post their complete code (at least the relevant parts). I am unable to reproduce locally, even after setting up a fresh environment.
Have you tried compiling a windows store app in release mode with .net native and optimizations enabled? (anniversary update) I found it worked most times when I run the same code in debug mode
Targeting .NET Native does cause some issues, but this is no surprise since there is no serialization configuration, as is required (https://msdn.microsoft.com/en-us/library/dn600638(v=vs.110).aspx).
@ViktorBergman @davideloper @edandersen Are you building in Debug or Release mode?
Yeah, unfortunately not much choice if you want to publish through the store :)
Tried to build in Release mode - the error still exists. So, I' m developing UWP app, VS 2015, I 've installed Microsoft.IdentityModel.Clients.ActiveDirectory and tried with both versions (3.xx, 2.13.xx), with no success. Basicly, I think, I do not need this package. The code: var msaAuthenticationProvider = new MsaAuthenticationProvider(CLIENT_ID, "https://login.live.com/oauth20_desktop.srf", new[] { "onedrive.readonly", "wl.signin", "wl.offline_access" }); await msaAuthenticationProvider.AuthenticateUserAsync();
Task authTask = null;
if (oneDriveClient == null)
{
var msaAuthProvider = new MsaAuthenticationProvider(clientId, returnUrl, scopes);
oneDriveClient = new OneDriveClient(baseUrl, msaAuthProvider);
authTask = msaAuthProvider.AuthenticateUserAsync();
AuthProvider = msaAuthProvider;
}
try
{
await authTask;
}
catch (ServiceException e)
{
Debug.WriteLine(e);
}
I am having the exact same exception. Above is my code. This code was taken almost exactly from the official UWP sample. No changes in user interface on the app during debugging either.
Nuget packages installed: Microsoft.OnedriveSDK v2.0.0, and Microsoft.OneDriveSdk.Authentication v1.0.1
Any news here @cdmayer ? Thanks in advance.
Investigating with high priority. To be clear, I am investigating issues that arise during authentication when .NET Native is enabled (this usually happens by default for Release builds). Will report back when I have news.
Is 'm not sure if this is really the problem. In app properties I have Active (debug) Configuration selected, and checkbox Compile with .NET Native tool chain unchecked. Should we try with some other settings or build properties?
You can see the latest in this branch: https://github.com/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/tree/async-updates
It would appear that if you build the branch that I linked (above) and reference the binaries directly from your project, everything should work. I am running into issues where packing it into a Nuget package still does not work. For now, please try cloning the above branch, building the binaries, and referencing them directly. Meanwhile, we are still working on getting this fully resolved internally.
The error doesn't happen to be related to this? http://stackoverflow.com/questions/38321069/json-serialization-error-when-updating-user-in-azure-ad-via-graph
I'm developing an UWP application and am experiencing the same problem but found that this only occurs when i run the app on my laptop. When i deploy it to my phone the login popup does show and it works as expected, either in debug or in release mode.
Probably OT but I'm finding it hard to be convinced as to why the breaking changes in 2.0 is worth upgrading. So, can anyone give us the elevator pitch for upgrading to 2.0?
Sorry for the delay all, but I am still working on the solution here.
@ViktorBergman, V2 was refactored to work with Graph.Core, which centralized things like AuthenticationProvider
and other components that any SDK/library accessing Graph (really, OData API) would need. V1 was almost an exact duplicate of the Graph.Core components (and in reality the latter was based on the former), and we didn't want to maintain two versions of the same code, so V2 was born.
For now, there is no big reason to move to V2. You can keep using V1 as-is and it will be fine. However, moving forward all new features and non-critical bugfixes will only target V2, so at some point it will be natural to move over to V2. Once these authentication issues are resolved, there should be little reason not to move over anyway because the code changes are minimal. If you disagree strongly, I would love to hear why!
@mhomde I don't believe that is related. Do you have reason to believe it is?
I have a candidate fix in this branch: https://github.com/OneDrive/onedrive-sdk-dotnet-msa-auth-adapter/tree/async-updates
Please try cloning this branch, building the binaries, then referencing them directly from your project (in place of the Nuget package). It solves the authenticationCancelled
issue on .NET Native for me, so I would love some verification.
New binaries are signed and uploaded to NuGet. Please try installing 1.0.2 of the Auth Adapter and let me know if it fixes your issue.
@cdmayer thanks. going to try this soon and report back
works for me, thanks!
Hmm, I still seem to have the same problem when compiling for .Net Native on desktop
Works for me too, thanks. I had to remove OneDrive sdk and OneDrive.Authentication and add them back to project.
@mhomde can you try uninstalling the old package installing the new one? Make sure it's 1.0.2.
If you are still having issues, please try adding this code where you invoke AuthenticateAsync
:
try
{
result = await authUi.AuthenticateAsync(requestUri, callbackUri);
}
catch (ServiceException ex)
{
var message = ex.Error.Code + ": " + ex.Error.Message;
throw;
}
Then insert a break point at the throw
line and tell me the value of message
.
Sorry for delay, wanted to publish through the store to make sure, and it seems to work https://www.microsoft.com/store/apps/9nblggh51jvk
Good job fixing the bug, thanks! Lots of cool possibilities with the OneDrive SDK, only thing I'm missing is real-time notifications
Using the latest 2.0 package I cannot sign in into OneDrive for Consumer:
AuthenticationCancelled is immediately thrown although no user interface is even presented that supposedly would cancel the authentication?
(edited for readability)