OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
293 stars 143 forks source link

Access Is Denied ?? #161

Closed assassin316 closed 8 years ago

assassin316 commented 8 years ago

When excuting AuthenticateUserAsync() I received Access is Denied. Am I doing something wrong ?? My app is a UWP app running on my laptop. Here is the code:

var msaAuthProvider = new MsaAuthenticationProvider(
                                "vYOOOL************************",
                                "https://login.live.com/oauth20_desktop.srf",
                                new string[]
                                {
                                    "onedrive.readonly",
                                    "wl.signin"
                                });

await msaAuthProvider.AuthenticateUserAsync();

var oneDriveClient = new OneDriveClient("https://api.onedrive.com/v1.0", msaAuthProvider);
assassin316 commented 8 years ago

UPDATE:

I've made some changes since this post. I've now correctly associated my app with the Store, and updated the code:

const string OneDriveBaseUrl = "https://api.onedrive.com/v1.0";
const string OneDriveAppId = "000000004*******";

var msaAuthProvider = new MsaAuthenticationProvider
                        (
                            OneDriveAppId,
                            OneDriveBaseUrl,
                            new string[] { "onedrive.readonly", "wl.signin" }
                        );

await msaAuthProvider.AuthenticateUserAsync();

var oneDriveClient = new OneDriveClient(OneDriveBaseUrl, msaAuthProvider);

When this code executes, the authetication then fails and shows a web page that states:

"We're unable to complete your request" "Microsoft account is experiencing technical problems. Please try again later."

VIEW THE ERROR HERE

cdmayer commented 8 years ago

Sorry for the delay. A new version of the Auth library has been released which uses single sign-on for UWP apps. Please give that a try and post here if that solves your issue.

assassin316 commented 8 years ago

The new OnlineIdAuthenticationProvider for UWP authenticates successfully! thank you :)

cdmayer commented 8 years ago

I am very glad to hear that :)