How to authenticate ionic app with Asp.net WebApi

I have a asp.net web api, that's been consumed by a ionic app.
This web api have some routes that need authorization and others that not.

is there anyway to configure the web api just to be consumed by the ionic app? Any help would be appreciated.

Thanks

This spreads in a wide scope. However irrespective of the back end API (Asp.net), you are asking how to authenticate an ionic app with back end API.

Basically u have main 3 options

1 - Using an existing Authentication implementation like OAuth2

basically you have to implement an Oauth2 server from your back end and have an ionic client to communicate with it

You will find some server libraries for .net in the OAuth2 web site

For client , you can use ng-cordova-oauth

2 - Let the Authentication handled by a 3rd party provider like (google)

  • What you can basically do it, let user to login through Ex: there google account,

  • send the api token to your back end api (in the first request)

  • Let the back end api validate the key with same provider

3 - Roll out your own authentication service

DONT :),

Try to implement a simple authentication service. But not the best way to go

HTH