mirror of
https://github.com/wanderer-industries/wanderer
synced 2026-03-28 06:17:57 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6970db438d | ||
|
|
9ab7fcc46e | ||
|
|
931a8e629d |
@@ -2,6 +2,15 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.97.3](https://github.com/wanderer-industries/wanderer/compare/v1.97.2...v1.97.3) (2026-03-25)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* core: Fixed character re-auth issues
|
||||
|
||||
## [v1.97.2](https://github.com/wanderer-industries/wanderer/compare/v1.97.1...v1.97.2) (2026-03-23)
|
||||
|
||||
|
||||
|
||||
@@ -897,21 +897,35 @@ defmodule WandererApp.Esi.ApiClient do
|
||||
end
|
||||
|
||||
defp invalidate_character_tokens(character, character_id, expires_at, scopes) do
|
||||
attrs = %{access_token: nil, refresh_token: nil, expires_at: expires_at, scopes: scopes}
|
||||
# Re-load from DB to avoid race with concurrent re-auth
|
||||
case WandererApp.Api.Character.by_id(character_id) do
|
||||
{:ok, current_character} ->
|
||||
# Only invalidate if tokens haven't been refreshed since we started
|
||||
if current_character.access_token == character.access_token do
|
||||
attrs = %{access_token: nil, refresh_token: nil, expires_at: expires_at, scopes: scopes}
|
||||
|
||||
with {:ok, _} <- WandererApp.Api.Character.update(character, attrs) do
|
||||
WandererApp.Character.update_character(character_id, attrs)
|
||||
else
|
||||
error ->
|
||||
Logger.error("Failed to clear tokens for #{character_id}: #{inspect(error)}")
|
||||
with {:ok, _} <- WandererApp.Api.Character.update(current_character, attrs) do
|
||||
WandererApp.Character.update_character(character_id, attrs)
|
||||
else
|
||||
error ->
|
||||
Logger.error("Failed to clear tokens for #{character_id}: #{inspect(error)}")
|
||||
end
|
||||
|
||||
Phoenix.PubSub.broadcast(
|
||||
WandererApp.PubSub,
|
||||
"character:#{character_id}",
|
||||
:character_token_invalid
|
||||
)
|
||||
else
|
||||
Logger.info(
|
||||
"[ApiClient] Skipping token invalidation for #{character_id} - tokens were refreshed concurrently"
|
||||
)
|
||||
end
|
||||
|
||||
{:error, _} ->
|
||||
Logger.error("Failed to load character #{character_id} for token invalidation")
|
||||
end
|
||||
|
||||
Phoenix.PubSub.broadcast(
|
||||
WandererApp.PubSub,
|
||||
"character:#{character_id}",
|
||||
:character_token_invalid
|
||||
)
|
||||
|
||||
:ok
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,6 +42,10 @@ defmodule WandererAppWeb.AuthController do
|
||||
|
||||
WandererApp.Character.update_character(character.id, character_update)
|
||||
|
||||
# Clear the invalid_grant counter so stale failures don't cause
|
||||
# premature token invalidation after a successful re-auth
|
||||
WandererApp.Cache.delete("character:#{character.id}:invalid_grant_count")
|
||||
|
||||
# Update corporation/alliance data from ESI to ensure access control is current
|
||||
update_character_affiliation(character)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user