3

Im trying to use google oauth with my vite react app but i dont know why the Authorized JavaScript origins is not working if i give http://127.0.0.1:5173 as the URIs but its working for http://localhost:3000 so i want to make my vite react app run on http://localhost:3000 insted of http://127.0.0.1:5173 when i type npm run dev and press o (to open the page on browser).

I even tried to make some changes to the vite.config.js but still not working below is the code

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    host: "localhost",
    port: 3000,
  },
});

In package.json file this is the change that i have made in package.json file

someone please help me with this.

Tried this

1 Answer 1

6

vite.config.ts

import dns from 'dns';

// localhost part
dns.setDefaultResultOrder('verbatim');

export default defineConfig({
  server: {
    port: 3000,
  },
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.