1-1. 프로젝트 생성을 한다
1-2. OAuth 동의 화면을 다음과 같이 작성한다.
1-3. OAuth 클라이언트 아이디를 생성
※ localhost 와 localhost:port 를 둘 다 적어주어야 한다!
완료!
import {GoogleLogin} from "@react-oauth/google";
import {GoogleOAuthProvider} from "@react-oauth/google";
import jwtDecode from "jwt-decode";
const GoogleLoginButton = () => {
const clientId = '${clientKey}'
return (
<>
<GoogleOAuthProvider clientId={clientId}>
<GoogleLogin
onSuccess={(res) => {
console.log(jwtDecode(res.credential));
}}
onFailure={(err) => {
console.log(err);
}}
/>
</GoogleOAuthProvider>
</>
);
};
배포한 사이트에서 clientKey 가 허락되지 않았다는 이슈로 막히고 있다 문제 해결 뒤 그 과정을 공유하고자 한다.