https://accounts.google.com/o/oauth2/v2/auth?
scope=https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email&
access_type=offline& // offline 으로 설정시, refresh_token 을 받을 수 있다.
include_granted_scopes=true&
response_type=code&
state=state_parameter_passthrough_value&
redirect_uri=리다이렉트URI& // code 를 받을 주소, 구글에 미리 셋팅필요
client_id=구글클라이언트ID
http://127.0.0.1:5500/pages/oauth2_redirect.html?
state=state_parameter_passthrough_value&
code=4%2F0AY0e-g5A4WpaPMpTdbP4gfLo3lCytTZG38k9mZAVC6q2wvflE5XzAArVkkNfdQdkcE9WYA&
scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&authuser=0&prompt=none
URL : https://www.googleapis.com/oauth2/v4/token
헤더 : Content-Type : application/x-www-form-urlencoded
var urlencoded = new URLSearchParams();
urlencoded.append("code", 2번에서 받은 code);
urlencoded.append("client_id", 구글 클라이언트 ID);
urlencoded.append("client_secret", 구글 클라이언트 SECRET);
urlencoded.append("redirect_uri", 리다이렉트 URI);
urlencoded.append("grant_type", "authorization_code"); // 고정값
https://www.googleapis.com/oauth2/v2/userinfo?access_token=3번에서얻은액세스토큰
URL : https://www.googleapis.com/oauth2/v2/userinfo
헤더 : Bearer + 3번에서얻은액세스토큰
URL : https://www.googleapis.com/oauth2/v4/token
헤더 : Content-Type : application/x-www-form-urlencoded
var urlencoded = new URLSearchParams();
urlencoded.append("client_id", 구글 클라이언트 ID);
urlencoded.append("client_secret", 구글 클라이언트S ECRET);
urlencoded.append("refresh_token", 리프레시토큰);
urlencoded.append("grant_type", "refresh_token"); // 고정값