์ธ ์ข ๋ฅ์ ์ฃผ์ฒด
kyrics
์ค๊ฐ์
youtube
๊ณผ์ ์ ์ต์ํด์ง๊ธฐ
์ฐ์ ์ฌ์ฉ์๊ฐ ์ฐ๋ฆฌ ์๋ฒ์๊ฒ ์ ์์ ํ๋ค.
์๋ฒ(resource server์ client)์ ํ๋ฉด์ ์ธ์ฆ์์ฒญํ๋ฉด์ด ๋์จ๋ค.
์ฌ์ฉ์๊ฐ ๋์๋ฅผ ํ๋ฉด resource server๋ก ์ ์ํ๊ฒ ๋๋ค.
๐๐ป "Redirect to Google's OAuth 2.0 server
scope list๋ฅผ ๋ณด์ฌ์ฃผ๊ณ resource server๊ฐ resource owner์๊ฒ accept๋ฅผ ์์ฒญํ๋ค.
ํด๋ผ์ด์ธํธ๊ฐcode, client id, client secretkey๋ฅผ resource server์๊ฒ ๋ค์ ๋ณด๋ธ๋ค.
๋ฌด๊ฒฐ์ฑ/๊ถํ ํ์ธ ํ์
access token์ ํด๋ผ์ด์ธํธ์๊ฒ ๋ฐ๊ธํ๋ค.
ํด๋ผ์ด์ธํธ๋ ๋ฐ๊ธ๋ฐ์ access token์ผ๋ก API๋ฅผ ์ฌ์ฉํ ์ ์๋ค.
์๋ ์ํ URL์ ์ฌ์ฉ์๋ฅผ ๋์ ํ์ฌ YouTube Data API ์์ฒญ์ ์ ์ถํ๊ธฐ ์ํด ์ ํ๋ฆฌ์ผ์ด์ ์ ๋ํ ๊ถํ ๋ถ์ฌ๋ฅผ ์์ฒญํ๋ Google ์ธ์ฆ ์๋ฒ URI๋ฅผ ํ์ํฉ๋๋ค.
https://accounts.google.com/o/oauth2/auth?
client_id=1084945748469-eg34imk572gdhu83gj5p0an9fut6urp5.apps.googleusercontent.com&
redirect_uri=http%3A%2F%2Flocalhost%2Foauth2callback&
scope=https://www.googleapis.com/auth/youtube&
response_type=code&
access_type=offline
scope
: ์ด๋ค ๊ถํ์ ์์ฒญํ๋์ง์ ๋ฒ์๋ฅผ ๋ช
์
์ฐ๋ฆฌ์ ๊ฒฝ์ฐ๋ https://developers.google.com/youtube/v3/docs/captions/download ์ฌ๊ธฐ์์ authorization scope ๋ค ์ค ํ์ํ ๊ฒ๋ค์ ์คํ์ด์ค๋ฅผ ๊ตฌ๋ถ์๋ก ๋ฃ์ด์ฃผ๋ฉด ๋๋ค. โ ๊ทผ๋ฐ ์ด๊ฑธ url์ธ์ฝ๋ฉํด์ ๋ฃ์ด์ค์ผํจ์
access_type
: ์คํ๋ผ์ธ ์จ๋ผ์ธ, ์คํ๋ผ์ธ์ refresh token๊น์ง ๋ฐ๊ธ. access token๋ง๋ฃ์ refresh token ์ฌ์ฉํด์ access token ์๋ก ๋ฐ๊ธ ๊ฐ๋ฅ
redirect url
: access token์ ๋ฐ์ผ๋ ค๊ณ ํ๋ ๊ณณ(client)์ url์ด๋ค. resource server๋ ์ธ์ฆ ์ ์ฐจ ํ ์ด๊ณณ์ผ๋ก access token์ ๋ณด๋ธ๋ค.
์ด ์ธ ํ๋ผ๋ฏธํฐ ์์ธ ์ ๋ณด ๐๐ป here!