Authorization Code grant type in desktop MFC application

我与影子孤独终老i 提交于 2019-12-11 19:05:52

问题


I'm developing a desktop MFC application which uses TradeStation WebAPI (http://tradestation.github.io/webapi-docs/). The WebAPI provides "Authorization Code Grant Type" (http://tradestation.github.io/webapi-docs/en/getting-started/security-overview/) which is the following: 1) The client application will route the end-user to our MFA (multi-factor authentication) login page web page. 2) Upon successful authentication; The user agent(browser) will be redirected to the URL provided and include an Authorization Code in the query string. 3) Some other stuff...

The problem is I don't know how to obtain the code from the step 2. I've looked some examples and found only two approaches.

  1. MFC application implements an embedded browser (rather than using the default system browser) derived from WebBrowser ActiveX control and implements BeforeNavigate event handler to get the code on redirection. Drawback - the embedded browser implementation is too heavy to obtain the only code, moreover it may be rejected by users who don't trust embedded browsers.
  2. The application uses the default system browser which is redirected to a web site. The web site accepts the code and then passes it to the application. Drawback - a web site required.

Both have drawbacks, and I'm wondering if there is other approaches to implement "Authorization Code grant type" in my application.


回答1:


Both approaches are valid, so you should go with the one that provides the best user experience. You can see more on implementing the embedded browser into your MFC application here http://msdn.microsoft.com/en-us/library/aa752046%28VS.85%29.aspx. You cannot remove the website requirement from the TradeStation WebAPI as it is designed primarily to service web and mobile applications.



来源:https://stackoverflow.com/questions/21433729/authorization-code-grant-type-in-desktop-mfc-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!