Windows/.NET Core Console + OAuth2 (Username + Password)

回答済み
新規投稿

コメント

2件のコメント

  • chadderack

    This is the part that is flummoxing me--the requirement to provide some sort of web-service endpoint as a callback for the auth service:

    var config = new BoxConfig("CLIENT_ID", "CLIENT_SECRET", new System.Uri("YOUR_REDIRECT_URL"));

     

    I don't want to roll a web service just to receive an OAuth 2 session in return; I'd like to be able to handle this in a desktop application via some kind of callback. 

    If that's not possible, please let me know so I can discuss this with the people passing down the requirement.


    Thank you!

    Chad.

    0
    コメントアクション パーマリンク
  • chadderack

    I'm going to post this as the solution, even though it would be nice to have a way to authenticate to Box using .NET and our own UI widgets.

    What I did instead of trying to use OAuth2 with the redirect_uri was to use the JWTToken method. This does allow you to authenticate to the Admin account and then switch to a user account. Done out of a console window Windows application. 

     

    This works fine. Remember to go to the Admin panel and to authorize the Box app--using the "Client ID". 

    To be fully clear, the reason the redirect_Uri wasn't right for my solution was that it would have needed an HTTPS endpoint to receive the auth code back from Box. I started down that path (using Web API), but soon realized that in order to get back to the desktop app it would have been way too much work--the code wanted to live in the Web API project.

    IF--on the other hand--someday Box decides to provide a way for people to bring up their own credentials challenge box (Username/Password) that would be a way to allow developers to use the full OAuth2 authentication path from a desktop application.

    Hope that helps someone.

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。