Skip to content

Commit

Permalink
catch invalid refresh token exception
Browse files Browse the repository at this point in the history
  • Loading branch information
StageGuard committed Jul 1, 2024
1 parent 856d329 commit 37a05f1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class OAuthManager {
suspend fun updateToken(user: User) : User {
if (user.tokenExpireUnixSecond < LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)) {
val response = refreshToken(user.refreshToken).mapLeft {
if(it is BadResponseException && it.respondText.contains("401")) {
if(it is BadResponseException && (it.respondText.contains("401") || it.respondText.contains("invalid"))) {
InvalidTokenException(user.qq)
} else it
}.rightOrThrowLeft()
Expand Down
26 changes: 26 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
server:
port: 5000
shiro:
ws:
server:
enable: true
url: "/ws/shiro"
qq: 202746796 # 为这个 BOT 启用插件
database:
address: localhost # 数据库地址
port: 3306 # 端口
user: root # 账号
password: testpwd # 密码
table: obmsug # 数据库名称(在准备工作第一步创建的数据库)
maximumPoolSize: 10
clientProxy: ''
osuAuth:
clientId: 8509 # OAuth clientId
secret: 'Pw62qscOyPgnfQIJSv7awxeNQnYSQcowO1p3Pz4G' # OAuth client secret
# 回调地址,必须和 OAuth 设置的相同(不包含 /authCallback)
# 注意这个地址是为了生成绑定账号的 OAuth 链接。
authCallbackBaseUrl: 'http://localhost:8081'
v1ApiKey: '8c515a93e53b27a719b891b316c40e240cca29d7' # vi api 密钥
frontend:
host: localhost # 前端主机地址,注意这个地址是实际主机地址
port: 8081 # 前端端口

0 comments on commit 37a05f1

Please # to comment.