locked
How can I make a login and registration Process to a WPF application? RRS feed

  • Question

  • User1052024640 posted

    I have made a login and registration by asp.net core identity via the tutorial of this https://www.youtube.com/watch?v=egITMrwMOPU&list=PL6n9fhu94yhVkdrusLaQsfERmL_Jh4XmU&index=65 yet.

    And now my WPF application needs to login and register with the server-side.

    I don't know how to communicate with the server-side and the WPF application.

    Is there any interface or middleware can solve this?

    In addition, the version of asp.net core is 3.0RC and the version of WPF is .net framework 4.8.

    Thank you.

    Wednesday, September 18, 2019 3:48 AM

Answers

  • User-474980206 posted

    the sample you used is cookie authentication and individual identity, with web pages for login and register. you need webapi calls to do the register and login. this calls can use the similar code to the pages.

    while its possible for a WPF application to use cookie authentication, its usually done via screen scraping, or hosting a browser control. 

    its more common to use bearer tokens (JWT). here is a simple example:

    https://jasonwatmore.com/post/2018/08/14/aspnet-core-21-jwt-authentication-tutorial-with-example-api

    this tutorial uses a simple list for the users database. you would of course use the identity you built above. 

    note: asp.net core 3.0 has better authorization support. the webapi template will support an oauth server, but does not include Individual (like your tutorial). the react / angular templates support Individual with JWT, and you could use one of these as a basis. but you will need to read the js code to determine the webapi calls.

    here a simple JWT tutorial for core 3.0 webapi with JWT and Indvidual authentication. 

    https://medium.com/developer-diary/net-core-3-0-preview-4-web-api-authentication-from-scratch-part-3-token-authentication-2d8af41b0045

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 18, 2019 4:00 PM

All replies

  • User-474980206 posted

    the sample you used is cookie authentication and individual identity, with web pages for login and register. you need webapi calls to do the register and login. this calls can use the similar code to the pages.

    while its possible for a WPF application to use cookie authentication, its usually done via screen scraping, or hosting a browser control. 

    its more common to use bearer tokens (JWT). here is a simple example:

    https://jasonwatmore.com/post/2018/08/14/aspnet-core-21-jwt-authentication-tutorial-with-example-api

    this tutorial uses a simple list for the users database. you would of course use the identity you built above. 

    note: asp.net core 3.0 has better authorization support. the webapi template will support an oauth server, but does not include Individual (like your tutorial). the react / angular templates support Individual with JWT, and you could use one of these as a basis. but you will need to read the js code to determine the webapi calls.

    here a simple JWT tutorial for core 3.0 webapi with JWT and Indvidual authentication. 

    https://medium.com/developer-diary/net-core-3-0-preview-4-web-api-authentication-from-scratch-part-3-token-authentication-2d8af41b0045

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 18, 2019 4:00 PM
  • User1052024640 posted

    Thanks a lot. Let me try first.

    Thursday, September 19, 2019 12:39 AM