I am sending a CORS request from my angular js application using $http service to asp.net web api.(web api 2.0).
My post request to web api.
js and chrome data:
When the request reaches to web api, the data becomes null.
data in visual studio:
my web api configuration.
Angularjs and web api applications are running in localhost with different ports.
Can any one suggest me, How can I solve this problem?
Thanks.
Related
I am developing a SPA using Vue.js and Laravel as a REST API in the backend. Now I want to cache some of those API calls for offline functionality, which I am having problems with when they are secured by a token.
I am setting the token in my application once a user is logged in.
Looking at the service worker request to the server I notice that the Authorization header is no set, so I am getting 500 error codes on those API calls.
Regards
Jan
You can try to store your data in the browsers local storage's.
IndexedDB is appropriated for that: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
https://developers.google.com/web/ilt/pwa/live-data-in-the-service-worker
I am creating an app and I need to invite Twitter users to my app through API. my question is
in Twitter is it possible to get follower list using front end (React) or do I need to use back-end like nodejs?
The following paragraph is no longer valid for Twitter API, please check the #Akshay Vijay Jain's answer.
Yes, you need a backend because when you use API KEY & API SECRET strings of your app in frontend like React, etc. they are will be usable from everyone. I can steal your API Credentials and use your API for my app this is will exploit your API quota, if you use a premium or enterprise API, I can exploit your money.
Jun 2020 Update.
It's NOT possible to connect to twitter API from front-end, by any means, because of same-origin policy of browser, I have done extensive research and experimentation
Twitter's response doesn't include Access-control-allow-origin header and so browser will discard the response in between actually browser makes a pre-flight request before actual request and response of the pre-flight request dictates browser to not make actual request to Twitter api.
Only solution is to create cors-enabled rest apis on your own node server and in handler of that rest API, call twitter api either using twitter-lite or twit and return the result back to the front-end as response of cors-enabled rest API
As mentioned in another answer, you can, but it’s not recommended. With API quota you better have twitter API responses cached to make your quota last through larger number of requests.
I am building my first full stack application. I have two seperate apps, a client app built with create-react-app and a node express server to serve json.
Currently, my create-react-app which uses Redux, makes ajax calls using axios to the port that my server is running on. I have set up authentication for the server to exchange a token with my client upon success.
My goal is to make use of the Spotify API. For their authentication, it says I need to get a authentication token from their server via my server.
I am not sure the proper way to go about this.
Currently my thought process is to have my client hit a new route in my server via a axios ajax call to have my server asynchronously exchange the token with the spotify api and then send it back to the client.. is this the proper way?
I've seen various other examples of this being done but they have their node/express app manage the routes for their entire application.
Any help would be greatly appreciated thanks.
I am new to web services so please help me to sort out my issue. I have a requirement to create a web service in C#. This web service will return the soap response.
my webservice should send response as a soap message, Is there any exmple of client and server which send an receive soap message , it is a non wcf webservice i tried with msdn but cant grab it.
thanks for any help....
You can try Fiddler or SOAPUI tool.
Using Fiddler, You can issue requests and get response from your Webservices locally.
Very efficient for testing your webservices locally on your m/c.
You can create a web service as an "ASP.Net Website" project in visual studio. Then you can add .asmx (web service code behind file) to your project. You can define your web methods in asmx file which may return xml as response. Then you have to publish and host the web service in IIS.
In client side project, you can add the reference to the webservice by using "Add Service reference" option in visual studio that will generate classes through which you can access your web service. Then you can call your web methods through those classes.
when you are adding service reference in client side, you have to give the url of the wsdl file of your web service to locate it.
I'm playing around with Apps for Office, an Excel TaskPane app.
I'm using AngularJS if that matters.
When I call my REST service build with WebApi I get access denied errors from the javascript.
I've read up on JSONP and CORS and enabled CORS in my REST service but to no help. I can't even see the request hitting my service or leaving Excel in fiddler.
In the app manifest I've tried to add my REST service to the allowed AppDomain's but this don't help either.
So is it possible to to call a cross domain REST service from an Apps For Office TaskPane app in Excel?
If so how?