GithubHelp home page GithubHelp logo

Comments (7)

ginach avatar ginach commented on July 29, 2024 1

Our webhooks sample is an example MVC app.

from onedrive-sdk-csharp.

ginach avatar ginach commented on July 29, 2024

Correct, GetMicrosoftAccountClient returns a OneDrive Consumer client. What you'll want to look into are the static methods in BusinessClientExtensions. The auth documentation has examples of creating a OneDrive for Business client under "Azure Active Directory (AAD) authentication".

Here's an example of creating a client using client ID and return URL:

var oneDriveClient = BusinessClientExtensions.GetActiveDirectoryClient(clientId, returnUrl);

await oneDriveClient.AuthenticateAsync();

This will use the Discovery Service to look up the service resource ID for authentication as well as the correct base URL for the API endpoint. If you do know these values already you can bypass the Discovery Service by providing them directly:

var oneDriveClient = BusinessClientExtensions.GetActiveDirectoryClient(
    clientId,
    returnUrl,
    oneDriveApiEndpoint,
    serviceResourceId)

await oneDriveClient.AuthenticateAsync();

The SDK is currently using ADAL for Business authentication.

from onedrive-sdk-csharp.

 avatar commented on July 29, 2024

Hi Gina,

I get this exception after calling AuthenticateAsync()

{"AADSTS90014: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: aa40c0d3-81bd-426d-b010-d777dc4a8d44\r\nCorrelation ID: 445f734b-af2e-46fe-8eaf-41c52eee3974\r\nTimestamp: 2016-01-07 06:48:58Z"}

But the constructor does not accept ClientSecret and the oneDriveClient ClientSecret is readonly

from onedrive-sdk-csharp.

 avatar commented on July 29, 2024

I am also getting this error

Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

from onedrive-sdk-csharp.

ginach avatar ginach commented on July 29, 2024

Authentication using client secret isn't fully implemented yet. Issue #36 is tracking this and I'm working on it this week. Apologies for the delay.

The best way to unblock would most likely be to use ADAL directly to obtain the token and build your own IAuthenticationProvider implementation that just appends it to requests. The AdalAuthenticationProvider class is the right place to start if you want to see what's there at the moment.

from onedrive-sdk-csharp.

skobba avatar skobba commented on July 29, 2024

Hi @ginach, how is it going with the client secret support? I'm using the SharePointClient at the moment, but cound not figure out how to access shared files and folders in my MVC Web App. Will this be easy in the new implementation, like the Graph API? Cheers!

from onedrive-sdk-csharp.

zuhaibshafi avatar zuhaibshafi commented on July 29, 2024

Hi Ginach, I currently can't find a way to authenticate OneDrive from ASP.NET MVC. Is there any sample available yet?

from onedrive-sdk-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.