Categories
Mastering Development

Why is Cors getting an error in React-admin? [duplicate]

I connected the admin panel in the client import React from "react" import { Admin, Resource } from "react-admin" import restProvider from ‘ra-data-simple-rest’ import PostList from "./PostList"; const AdminPage = () => { return ( <Admin dataProvider={restProvider(‘http://192.168.88.83:3001′)} > <Resource name=’blogs’ list={PostList} /> </Admin> ); } export default AdminPage but the console shows an error admin#/blogs:1 […]

Categories
Mastering Development

No Access-Control-Allow-Origin after many calls edit > Axios network error catch

I’ve googled this issue very often and I think I’ve inserted them all which I know is redundant but I’m desperate. In my server I’ve added: app.use(cors()) and app.use(function (req, res, next) { res.setHeader(‘Access-Control-Allow-Origin’, ‘*’); res.setHeader(‘Access-Control-Allow-Headers’, ‘Origin, X-Requested-With, Content-Type, Accept’); res.setHeader(‘Access-Control-Allow-Methods’, ‘POST, GET, PATCH, DELETE, OPTIONS’); next(); }); and in the route, I’ve added: router.use([‘/api/’, […]

Categories
CMS Drupal Mastering Development

How do I delete a comment? [closed]

Actually I have problems with deleting a comment via REST in Drupal 8.99 and 9.0.7. I have no problem when using a POST, PATCH, or GET requests. Otherwise, I get this error. Path: /c24102020/comment/51418?_format=hal_json. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 120 of /var/www/html/c24102020/core/lib/Drupal/Core/Routing/AccessAwareRouter.php). My end-point is http://localhost/c24102020/comment/51418?_format=hal_json. The headers for the request are the following. X-CSRF-Token Content-Type: […]

Categories
Mastering Development

Django + React Able to create new user in database, but token-auth returns 400 bad request

So I have an app that I’m writing. It’s working, for the most part, so far. I only currently have a login and signup setup, with a ‘homepage’ that just has a logout button and some text on it so I can test. When I do signup, it posts the user to the database, but […]

Categories
Mastering Development

CORS error with passport github on a MERN app is about to drive me crazy [duplicate]

I keep getting this cors error on the client side. I tried hosting the app but the error is still persistent. I’m working on a node/express/passport app with react frontend. I have enable cors for the appropriate url. I don’t know what else to do. Anyone with helpful information, please share. BAckend code const sessionOptions […]

Categories
Mastering Development

django-cors-headers not work in for patch method

INSTALLED_APPS = [ # default django apps ‘jazzmin’, ‘django.contrib.admin’, ‘django.contrib.auth’, ‘django.contrib.contenttypes’, ‘django.contrib.sessions’, ‘django.contrib.messages’, ‘django.contrib.staticfiles’, # Optional: Django admin theme (must be before django.contrib.admin) ‘rest_framework’, ‘rest_framework_simplejwt.token_blacklist’, ‘corsheaders’, ‘treebeard’, ‘UserAccount.apps.UseraccountConfig’, ‘CompanyInfo.apps.CompanyInfoConfig’, ‘Backup.apps.BackupConfig’, ‘FinancialPeriod’, ‘Inventory.apps.InventoryConfig’, ‘Product.apps.ProductConfig’, ] MIDDLEWARE = [ ‘corsheaders.middleware.CorsMiddleware’, ‘django.middleware.security.SecurityMiddleware’, ‘django.contrib.sessions.middleware.SessionMiddleware’, ‘django.middleware.common.CommonMiddleware’, ‘django.middleware.csrf.CsrfViewMiddleware’, ‘django.contrib.auth.middleware.AuthenticationMiddleware’, ‘django.contrib.messages.middleware.MessageMiddleware’, ‘django.middleware.clickjacking.XFrameOptionsMiddleware’, ] CORS_ORIGIN_ALLOW_ALL = True CORS_ALLOW_CREDENTIALS = False default_headers = ( […]

Categories
Mastering Development

backend internalization change language session vs system

So I’ve got my backend written in nodejs and I’m using i18next for internalization. I’m also using it on the frontend. The frontend’s language is determined by the domain. e.g. es.domain.com is spanish and ja.domain.com is japanese etc. On the backend the goal is to determine the users language via the domain origin and change […]

Categories
Mastering Development

Battling a ‘same policy’ CORS when doing a post request with Express

I have an issue when I want to create a new account on my website. Everything works fine when hosted as localhost but as soon as it’s hosted on AWS, I have the famous Same-Policy CORS issue. To create an account, I have an OPTIONS request and a POST request. The OPTIONS request is empty […]

Categories
Linux Mastering Development Ubuntu

problem with config working in nginx 1.4/trusty and don’t work in nginx 1.14/bionic

I have installed an application "load balancer", on a Ubuntu 14.04 LTS server with nginx 1.4 (the version handled in this Ubuntu release). Now we are in the process of emergency update of the servers with versions already without updates, outdated. The problem happens with a vhost in nginx, its configuration works fine in nginx […]

Categories
Mastering Development

How do I login successfully with the code I have?

How do I use this code to make the login work? When the login button is click, it didn’t login at all. Not sure what is the error as it’s not shown. login() { var url = ‘https://login.app/login’; var postData = JSON.stringify({ // saving it as Email and will be used at server.js Email: this.loginForm.value[’email’], […]