* 2021.01.18 ๊ธฐ์ค ์๋ ํ์ธ๋จ.
1. ๊ตฌ๊ธ API Console ์ ์
- ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ ์ํ์ฌ Google+ API ์ฌ์ฉ ํด๋ฆญ.
2. ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด ๋ง๋ค๊ธฐ
- ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด ํญ์์ ์๋จ์ '์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด ๋ง๋ค๊ธฐ' ํด๋ฆญ ํ, OAuth Client ID ํด๋ฆญ.
- ์ ํ์ ์น ์ ํ๋ฆฌ์ผ์ด์ ์ ํ ํ, Local ์์ ํ ์คํธ๋ฅผ ์ํด, localhost ์ฃผ์ ์ ๋ ฅ
- ํ๋จ์ ๋ง๋ค๊ธฐ ๋ฒํผ์ ํด๋ฆญํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ์ ๋ณด๊ฐ ๋ธ.
์ฌ๊ธฐ์, ํด๋ผ์ด์ธํธ ID ๋ฅผ ๋ณต์ฌํด๋๋๋ค.
3. ์๋น์ค์ ๋ก๊ทธ์ธ ๋ฒํผ ์ถ๊ฐ ๋ฐ ์์
- ์์ค ํค๋์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ถ๊ฐ.
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="google-signin-client_id" content="ํด๋ผ์ด์ธํธID.apps.googleusercontent.com">
- ๋ก๊ทธ์ธ ๋ฒํผ ์ถ๊ฐ.
<div class="g-signin2" data-onsuccess="onSignIn"></div>
- ๋ก๊ทธ์ธ ํ, ์ ๋ณด ๊ฐ์ ธ์ค๋ ์คํฌ๋ฆฝํธ ์ถ๊ฐ.
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
}
- ์ดํ, ์ด ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ ์๋ฒ-์ฌ์ด๋๋ก ๋๊ฒจ์ ์ฒ๋ฆฌํ๊ฑฐ๋ ๊ธฐํ ๋ฑ๋ฑ ์ํ๋ ์์ ์ ์ฐ๋ํ๋ค.
- ๋ก๊ทธ์์ ๋ฒํผ ์ถ๊ฐ, ํด๋น ๋ฒํผ์ ํด๋ฆญํ๋ฉด ์ฐ๋์ด ํด์ ๋๋ค.
<a href="#" onclick="signOut();">Sign out</a>
<script>
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log('User signed out.');
});
}
</script>
์ ๋ณด๋ฅผ ๊ฐ์ ธ์ค๊ณ , ๋ก๊ทธ์์ ํ๋ ๋ถ๋ถ์ ๊ตฌ๊ธ์์ ํ๋ ๊ฒ์ด๊ณ ,
์๋น์ค์์ ์ค์ ๋ก๊ทธ์ธ, ํ์๊ฐ์ ๋ฑ๋ฑ์ ๊ตฌํ์ ์ง์ ํด์ผ ํ๋ค.
์ฐ๋์ด ๋งค์ฐ ์ฌ์ดํธ์ด๋ผ ์ฝ๊ฒ ๋ฐ๋ผํ ์ ์์๋ค.
'๐Etc' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Linux] Svn Conflict Option (0) | 2021.02.06 |
---|---|
ERR_INCOMPLETE_CHUNKED_ENCODING 200 (0) | 2021.01.27 |
๋๊ธ