locked
How to create a Login Web Api for different mobile user to login RRS feed

  • Question

  • User-1980778524 posted

    Hi I m a newbie in Web Api.

    say I have create an asp.net MVC app to register a user with username and password.

    Which web service I should use for iOS/Android/Xamarin user to login?

    I m a bit confused as to how diff mobile user consume the web Api web service to login.  Is Web Api Web service is REST web service?

    There is Web API web service , can you show me an example or reference to follow on how Mobile user consume the Web api web service?

    Thanks

    Saturday, April 8, 2017 2:52 PM

All replies

  • User-284744251 posted

    Your Web API can be consumed by website running in desktop or mobile. You can refer following link to learn managing of login from Web API

    https://www.codeproject.com/Articles/1072245/How-can-you-use-Web-API-to-authenticate-users-of-y

    Saturday, April 8, 2017 6:34 PM
  • User-2057865890 posted

    Hi SkyDriving,

    Using ASP.NET Web API, you can program for HTTP verbs such as GET, POST, PUT and DELETE. Once created you can consume the Web API in a wide range of clients including web applications, desktop applications and mobile applications. You may consider reading Introduction to ASP.NET Web API before going any further.

    Web service APIs that adhere to REST are called RESTful APIs, and are defined using:

    A base URI.
    HTTP methods, such as GET, POST, PUT, PATCH, or DELETE.
    A media type for the data, such as JavaScript Object Notation (JSON).

    HttpClient is a modern HTTP client for .NET applications. It can be used to consume functionality exposed over HTTP. For example, a functionality exposed by an ASP.NET Web API can be consumed in a desktop application using HttpClient. Using HttpClient you can send requests and receive responses using standard HTTP verbs such as GET, POST, PUT and DELETE. 

    #ASP.NET Web API 2 – Web Services for Websites, Modern Apps, and Mobile Apps
    https://channel9.msdn.com/Events/Build/2013/3-504 

    #Introduction to Web Services
    https://developer.xamarin.com/guides/cross-platform/Application_Fundamentals/Web_Services/

    Best Regards,

    Chris

    Monday, April 10, 2017 2:35 AM
  • User-1980778524 posted

    Hi Chris,

    Now I know what is Web Api.

    I am confused over authentication using Asp.net MVC. 

    In my previous experience, I used asp.net ( no MVC) , in the code-behind I can validate the username and password against the User-database and I dont use Authentication.

    Can you provide me a sample of login webservice consume by Mobile Client as well as using Asp.net MVC itself  to follow to further strengthen my understanding?

    To login Asp.net MVC, I dont use Web service, I use Brower right?

    Thanks

    Tuesday, April 11, 2017 1:21 PM
  • User475983607 posted

    Authentication is the process of exchanging a valid username and password for a token.  Form this point on the client passes the token to access server resources.  There are several ways to perform authentication and the method you choose is dependent on what you're trying to secure.

    Anyway, there is a lot of information on the subject.  Start here and branch off...

    https://www.asp.net/web-api/overview/security

    Tuesday, April 11, 2017 10:31 PM