Skip to content
Snippets Groups Projects
Commit 6f24535b authored by Hugh Daschbach's avatar Hugh Daschbach Committed by Marge
Browse files

Auto logout on unrecoverable authentication error.

When an unrecoverable authentication error occurs, automatically log
the user out.  This seems better than leaving the user wondering why
the UI is unresponsive or why each track they try to play fails with a
quickly disappearing toast.

Unrecoverable authentication errors typically mean the server has
timed out the session out or the session token has been deleted on the
server.  Tokens expire after 14 days without use.

Part-of: <!342>
parent 467556d7
No related branches found
No related tags found
1 merge request!342Address issue #154
...@@ -63,6 +63,7 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request { ...@@ -63,6 +63,7 @@ fun Request.authorize(context: Context, oAuth: OAuth): Request {
Log.e("Request.authorize()", "performActionWithFreshToken failed: $e") Log.e("Request.authorize()", "performActionWithFreshToken failed: $e")
if (e.type != 2 || e.code != 2002) { if (e.type != 2 || e.code != 2002) {
Log.e("Request.authorize()", Log.getStackTraceString(e)) Log.e("Request.authorize()", Log.getStackTraceString(e))
EventBus.send(Event.LogOut)
} }
} }
if (token != old && token != null) { if (token != old && token != null) {
......
...@@ -103,6 +103,7 @@ class OAuth(private val authorizationServiceFactory: AuthorizationServiceFactory ...@@ -103,6 +103,7 @@ class OAuth(private val authorizationServiceFactory: AuthorizationServiceFactory
if (e != null) { if (e != null) {
Log.e("OAuth", "performTokenRequest failed: $e") Log.e("OAuth", "performTokenRequest failed: $e")
Log.e("OAuth", Log.getStackTraceString(e)) Log.e("OAuth", Log.getStackTraceString(e))
EventBus.send(Event.LogOut)
} else { } else {
state.apply { state.apply {
Log.i("OAuth", "applying new authState") Log.i("OAuth", "applying new authState")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment