@@ -68,10 +68,12 @@ class OauthRefreshTokenAuthenticator(
6868 return null
6969 }
7070
71- val errorCode = getErrorCode(response.peekBody(200 ).string())
71+ val errorCode = getErrorCode(response.peekBody(Long . MAX_VALUE ).string())
7272 if (errorCode != null ) {
7373 when (errorCode) {
74- TOKEN_EXPIRED_ERROR_MESSAGE , JWT_TOKEN_EXPIRED -> {
74+ TOKEN_EXPIRED_ERROR_MESSAGE ,
75+ JWT_TOKEN_EXPIRED ,
76+ -> {
7577 try {
7678 val newAuth = refreshAccessToken(refreshToken)
7779 if (newAuth != null ) {
@@ -98,7 +100,10 @@ class OauthRefreshTokenAuthenticator(
98100 }
99101 }
100102
101- TOKEN_NONEXISTENT_ERROR_MESSAGE , TOKEN_INVALID_GRANT_ERROR_MESSAGE , JWT_INVALID_TOKEN -> {
103+ TOKEN_NONEXISTENT_ERROR_MESSAGE ,
104+ TOKEN_INVALID_GRANT_ERROR_MESSAGE ,
105+ JWT_INVALID_TOKEN ,
106+ -> {
102107 // Retry request with the current access_token if the original access_token used in
103108 // request does not match the current access_token. This case can occur when
104109 // asynchronous calls are made and are attempting to refresh the access_token where
@@ -118,7 +123,10 @@ class OauthRefreshTokenAuthenticator(
118123 }
119124 }
120125
121- DISABLED_USER_ERROR_MESSAGE , JWT_DISABLED_USER_ERROR_MESSAGE -> {
126+ DISABLED_USER_ERROR_MESSAGE ,
127+ JWT_DISABLED_USER_ERROR_MESSAGE ,
128+ JWT_USER_EMAIL_MISMATCH ,
129+ -> {
122130 runBlocking {
123131 appNotifier.send(LogoutEvent ())
124132 }
@@ -241,6 +249,8 @@ class OauthRefreshTokenAuthenticator(
241249 private const val JWT_TOKEN_EXPIRED = " Token has expired."
242250 private const val JWT_INVALID_TOKEN = " Invalid token."
243251 private const val JWT_DISABLED_USER_ERROR_MESSAGE = " User account is disabled."
252+ private const val JWT_USER_EMAIL_MISMATCH =
253+ " Failing JWT authentication due to jwt user email mismatch with lms user email."
244254
245255 private const val FIELD_ERROR_CODE = " error_code"
246256 private const val FIELD_DETAIL = " detail"
0 commit comments