개발/기타
[OAuth] oauth2 작동 방식
윤호
2022. 1. 4. 18:48
구글(resource server)과 같은 서비스에서 access 토큰을 발급, 이 토큰으로 서비스에 제한적으로 접근할 수 있다.
- my application = client
- user = resource owner
- google = resource server
- 등록 : client가 resource server를 사용하기 위해 등록하는 과정
- Client ID
- Client Secret : 절대 외부로 노출되면 안되는 값
- authorized URI : 인증후에 user가 보게될 화면의 주소. client가 갖고있는 uri를 적어야한다.
- The value of this parameter must exactly match with one of the redirect_uri values that is listed for your project in the Zoho's Developer Console.
- resource Owner의 승인
- user가 ui로 정보제공 등을 승인함.
- resource server의 승인
- resource server는 유저의 승인을 확인하고 authroization code를 발급
- 유저가 authorized URI?code=[authorization code] 로 접속하도록 함
- 이를 통해 client는 authorization code를 알 수 있음
- 액세스 토큰 발급
- client가 resource server에게 client secret, clientId, authorized code 를 전달
- resource server는 이를 확인하고 access 토큰을 발급한다.
reference : 생활코딩 WEB2 - OAuth 2.0