Request reauth

This commit is contained in:
rxdn 2022-06-05 01:57:34 +01:00
parent 5507c4330e
commit a22313066a

View File

@ -63,7 +63,7 @@ func ReloadGuildsHandler(ctx *gin.Context) {
store.AccessToken = res.AccessToken store.AccessToken = res.AccessToken
store.RefreshToken = res.RefreshToken store.RefreshToken = res.RefreshToken
store.Expiry = (time.Now().UnixNano()/int64(time.Second))+int64(res.ExpiresIn) store.Expiry = (time.Now().UnixNano() / int64(time.Second)) + int64(res.ExpiresIn)
if err := session.Store.Set(userId, store); err != nil { if err := session.Store.Set(userId, store); err != nil {
ctx.JSON(500, utils.ErrorJson(err)) ctx.JSON(500, utils.ErrorJson(err))
@ -72,7 +72,12 @@ func ReloadGuildsHandler(ctx *gin.Context) {
} }
if err := utils.LoadGuilds(store.AccessToken, userId); err != nil { if err := utils.LoadGuilds(store.AccessToken, userId); err != nil {
ctx.JSON(500, utils.ErrorJson(err)) // TODO: Log to sentry
// Tell client to reauth, needs a 200 or client will display error
ctx.JSON(200, gin.H{
"success": false,
"reauthenticate_required": true,
})
return return
} }