Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After login with google Id , its not redirecting to home. #32

Open
Pranjaliyadav opened this issue Dec 12, 2022 · 6 comments
Open

After login with google Id , its not redirecting to home. #32

Pranjaliyadav opened this issue Dec 12, 2022 · 6 comments

Comments

@Pranjaliyadav
Copy link

After login through pop up, it's not redirecting to home page. There's no error showing up too, so I got no idea what went wrong. Please help asap!!!

@Urvik07
Copy link

Urvik07 commented Dec 12, 2022

check the link you provided in Authorized JavaScript origins in Console.cloud.google.com it should be http://localhost:3000
image

@Pranjaliyadav
Copy link
Author

Screenshot 2022-12-16 173118
Screenshot 2022-12-16 173208

Yes, Its all there.
Does one of these issues causing this?

@Pranjaliyadav
Copy link
Author

check the link you provided in Authorized JavaScript origins in Console.cloud.google.com it should be http://localhost:3000 image

!

@Urvik07
Copy link

Urvik07 commented Dec 23, 2022

have you add url2 also?

@fatihbatu
Copy link

I got the same problem can you help me to figure it out


Screenshot 2023-02-26 at 15 39 37

Screenshot 2023-02-26 at 15 39 51

Login.jsx


import React from "react"; // import { useGoogleLogin } from "@react-oauth/google"; import { GoogleLogin, googleLogout } from "@react-oauth/google"; import { useNavigate } from "react-router-dom"; // import { FcGoogle } from "react-icons/fc"; import shareVideo from "../assets/share.mp4"; import logo from "../assets/logo.png"; import jwt_decode from "jwt-decode";

import { client } from "../client";

const Login = () => {
const navigate = useNavigate();

const responseGoogle = async (response) => {
// console.log(response);
const decoded = jwt_decode(response.credential);
// console.log(decoded);
const { name, picture, sub } = decoded;
// console.log(name);
// console.log(picture);
// console.log(sub);
console.log(process.env.REACT_APP_SANITY_TOKEN);

const doc = {
  _id: sub,
  _type: "user",
  userName: name,
  image: picture,
};
// console.log(JSON.stringify(doc));

localStorage.setItem("user", JSON.stringify(doc));

client.createIfNotExists(doc).then(() => {
  navigate("/", { replace: true });
});

};

const user = false;

return (





);
};

export default Login;



client.js


import sanityClient from "@sanity/client"; import imageUrlBuilder from "@sanity/image-url";

export const client = sanityClient({
projectId: process.env.REACT_APP_SANITY_PROJECT_ID,
dataset: "production",
apiVersion: "2021-11-16",
useCdn: true,
token: ${process.env.REACT_APP_SANITY_TOKEN},
});

const builder = imageUrlBuilder(client);

export const urlFor = (source) => builder.image(source);

@fatihbatu
Copy link

fatihbatu commented Feb 26, 2023

I solved it by changing sanity API token DEPLOY STUDIO to EDITOR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants