cors

Access-Control-Allow-Origin Error when trying to add open graph meta tags dynamically via Firebase functions

本秂侑毒 提交于 2019-12-25 04:01:17
问题 I'm trying to add open graph meta tags dynamically to my index.html using firebase functions. I'm following this tutorial but because I'd like to allow users to share on their facebook I need to add open graph meta tags on-demand when user wants to share content. So, it seems to me that running the function via rewrite in firebase.json is not best solution here and I'd like to call the function when user wants to share content to Facebook. I try to use CORS but it seems I get the "Access

Authentication Request to Spotify Web API Rejected

徘徊边缘 提交于 2019-12-25 03:26:20
问题 I am trying to send an authentication request to Login to Spotify. This is run through local host by a javascript XMLHttpRequest. However all I ever receive is an error message stating: XMLHttpRequest cannot load https://accounts.spotify.com/authorize/?q=undefined&type=code&client_id=9f5…ope=user-read-private%20user-read-email%20streaming&state=iKX8sdHHEML6BxRy. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin "localhost" is therefore not allowed access." I

Angular client enable CORS

巧了我就是萌 提交于 2019-12-25 03:22:34
问题 CORS is fine on server and works as intended. I tried sending requests to my server's REST API with the angular HTTPClient and I receive a CORS error. Why is this an error if CORS is enabled on the server? Shouldn't it be fine on the client? Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3000/api/blah/blah (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). How can I enable CORS on this request please..... 回答1: You dont

Including Cookies on a AJAX Request for Cross Domain Request Using Pure Javascript

六眼飞鱼酱① 提交于 2019-12-25 02:49:35
问题 I am developing Analytics application and I need a way to identify each user device uniquely. For this, the approach I am following is creating a "cookie" from a server side. All page clicks and tracking will be updated to server using Ajax requests. My problem is, I have my analytics in xyz.com. Abc.com and 123.com are the applications which installs my plugin(javascript) code. On the first visit, I am creating a cookie "sha1" to identify each user/device uniquely, on each consecutive

Workaround for external API which does not have CORS enabled?

可紊 提交于 2019-12-25 02:15:19
问题 What can be the workarounds for using an external API like Docusign which does not have CORS enabled and requires a custom HTTP header for authentication ? I am trying to integrate this API with my angular app running on localhost. I cannot add Access-Control-Allow-Origin Header and disabling web security on Chrome is a foolish solution. JSONP is also out of the window as I cannot add a custom HTTP Header to a JSONP request. 回答1: What can be the workarounds for using an external API like

How to make the Browser include the cookies of the domain of the host origin when making a cross-origin HTTP request

。_饼干妹妹 提交于 2019-12-25 01:55:26
问题 I made a cross-origin HTTP request from the website 'demo.home.com' to 'demo.company.com' using the Fetch api with the credentials set to 'include'. There are two cookies. One is 'cookie_home=123; Domain=demo.home.com', the other is 'cookie_company=456; Domain=demo.company.com'. As a result, the cookie 'cookie_company' was included by the request. Is there any way to let the cookie 'cookie_home' be included by the request? // the request is made in the website 'http://demo.home.com' // the

Authorization Header appended only once in AJAX CORS request

Deadly 提交于 2019-12-25 01:52:05
问题 I'm calling my RESTful API from Javascript in a CORS scenario. I'm using JQuery to send my POST authenticated request. Here is an example: function post(settings, addAccessToken) { settings.type = 'POST'; settings.cache = false; if (settings.dataType === undefined) settings.dataType = 'json'; if (addAccessToken) { settings.xhrFields = { withCredentials: true }; settings.beforeSend = function (request) { request.setRequestHeader('Authorization', 'Bearer <my access token>'); }; settings.headers

How to fix “Response to preflight request doesn't pass access control check: It does not have HTTP ok status” error in react app with nodejs api

我是研究僧i 提交于 2019-12-25 01:13:28
问题 I have been trying to do an api call (nodejs with express running on localhost) from a react app running in the browser over a local dev server (web-pack dev server). Everything was working well until I tried to call the api. They are both running on separate ports. I have tried adding the cors headers (Recommended by MDN) to both the post call (from the app in browser) and to the response from the Nodejs API but neither of these solved the issue. Code for the api call (in browser): const

CORS header not working for Django backend- Angular frontend

穿精又带淫゛_ 提交于 2019-12-25 00:51:04
问题 I implemented CORS on my Django backend by installing django-cors-headers and following the steps mentioned in- https://github.com/OttoYiu/django-cors-headers . Essentially, I performed the following steps- pip install django-cors-headers INSTALLED_APPS = ( ... 'corsheaders', ... ) MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', ... ] CORS_ORIGIN_WHITELIST = ( 'localhost:8000', #LB '10.254.138.226:443' ) I still can not make it work when I

Authorization header not working for angular 2

浪尽此生 提交于 2019-12-25 00:43:03
问题 Hello I am using the Ionic 2 framework with Angular and I want to make a http request with the authorization header but it appears it is not sending the header. What have I done wrong? @Injectable() export class UserServiceProvider { private loginSuccess: any; constructor(public http: Http) { console.log('Hello UserServiceProvider Provider'); } login(username, password) { var token = btoa(username + ':' + password); alert(token); this.loginSuccess = false; let headers = new Headers(); headers