Skip to content

Commit 7f32072

Browse files
rmmeanstsuyoshizawa
authored andcommitted
Redirect Uri Mismatch error alignment with specification (#108)
Currently, the RedirectUriMismatch error is using a non-standard errorType. Google popularized this error, but it is not part of the standard specification. Section 4.1.2.1 specifically states ` If the request fails due to a missing, invalid, or mismatching redirection URI …` and the valid error types listed that can be returned does not include `redirect_uri_mismatch`. I propose of the errors listed, the one that makes the most sense is `invalid_request` additionally, we can use the `error_description` field which is optional to provide the existing message of `redirect_uri_mismatch` so the developer knows what he did wrong.
1 parent eeda1c1 commit 7f32072

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

scala-oauth2-core/src/main/scala/scalaoauth2/provider/OAuthException.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class UnauthorizedClient(description: String = "") extends OAuthError(descriptio
2626

2727
}
2828

29-
class RedirectUriMismatch(description: String = "") extends OAuthError(description) {
29+
class RedirectUriMismatch(description: String = "redirect_uri_mismatch") extends OAuthError(description) {
3030

31-
override val errorType = "redirect_uri_mismatch"
31+
override val errorType = "invalid_request"
3232

3333
}
3434

scala-oauth2-core/src/test/scala/scalaoauth2/provider/OAuthErrorsSpec.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class OAuthErrorsSpec extends FlatSpec {
3232
}
3333

3434
it should "produce a 400 status code for redirect_uri_mismatch" in {
35-
new RedirectUriMismatch().statusCode should be(400)
35+
val error = new RedirectUriMismatch()
36+
error.statusCode should be(400)
37+
error.errorType should be("invalid_request")
3638
}
3739

3840
behavior of "OAuth Error Handling for Bearer Tokens RFC 6750 Section 3.1"

0 commit comments

Comments
 (0)