1
==== 기본 일치(base match) ====
실제 URI와 등록 URI가 베이스 영역만 일치하면 인증을 수락함.
* 실제 URI: http://example.org/path/to/something?foo=bar&color=dark
* 등록 URI: http://example.org/path/
* 실제 URI와 등록 URI가 정확하게 일치하지는 않으나, 베이스 영역이 일치함.
==== 완전 일치(completation match) ====
실제 URL와 등록 URI가 완전하게 일치하면 인증을 수락함.
* 실제 URI: http://example.org/path/to/something?foo=bar&color=dark
* 등록 URI: http://example.org/path/to/something?foo=bar&color=dark
* 실제 URI와 등록 URI가 정확하게 일치함.
==== 구글(Google) 사례 ====
구글 API 콘솔 (Google API console)에서의 Redirect URI 정의는 완전 일치(completation match)를 확인함.
클라이언트 ID
*-*.apps.googleusercontent.com
클라이언트 보안 비밀
*-*
생성일
2018. 1. 2. 오후 2:57:53
이름
제한사항
자바스크립트 원본과 리디렉션 URI 중 1개를 입력하거나 둘 다 입력하세요.
승인된 자바스크립트 원본
브라우저의 요청에 따라 사용되며 클라이언트 애플리케이션의 원본 URI입니다. 와일드 카드(https://*.example.com)나 경로(https://example.com/subdir)를 포함할 수 없습니다. 비표준 포트를 사용하고 있다면 이 포트를 원본 URI에 포함해야 합니다.
http://example.org
승인된 리디렉션 URI
웹 서버의 요청에 사용되며 사용자가 Google을 통해 인증된 후 리디렉션되는 애플리케이션의 경로입니다. 경로가 액세스용 승인 코드와 함께 포함됩니다. 프로토콜이 있어야 합니다. URL 조각 또는 상대 경로는 포함할 수 없으며 공개 IP 주소를 사용할 수 없습니다.
http://example.org/path/ ---- (1)
http://example.org/path/to/something?foo=bar&color=dark ---- (2)
구글 API 요청은 완전 일치(completation match) 방식을 사용하므로 (1)의 URI만 등록할 경우 아래 메시지를 확인하게 된다.
Error: redirect_uri_mismatch
The redirect URI in the request, http://example.org/path/to/something?foo=bar&color=dark, does not match the ones authorized for the OAuth client. Visit https://console.developers.google.com/apis/credentials/oauthclient/*-*.apps.googleusercontent.com?project=701773203431 to update the authorized redirect URIs.
Learn more
Request Details
response_type=code
client_id=*-*.apps.googleusercontent.com
redirect_uri=http://example.org/path/to/something?foo=bar&color=dark
state=something_state
scope=http://www.blogger.com/feeds/
access_type=offline
That’s all we know.
이 경우 완전 일치 방식에 따라 실제 이동하는 URI를 (2)와 같이 정확하게 입력해주면 정상적으로 인증이 수행된다.
==== 참고 사항 ====
Redirect URI는 인증 정보를 응답으로 받을 실제 주소를 처리하므로 기본 일치(base match) 방식을 쓴다 하여도 실제 응답을 받을 수 있는 프로그램이 해당 경로에 비치되어 있지 않으면 활용할 수 없다. 그러므로, 모든 경우에서 유효한 방식은 완전 일치(completation match)이다.