Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Created May 31, 2020 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/f6b75a572a60960a35b6d848b4cecad7 to your computer and use it in GitHub Desktop.
Save chelseatroy/f6b75a572a60960a35b6d848b4cecad7 to your computer and use it in GitHub Desktop.
Save Session Data Upon Successful Login
class LoginActivity : AppCompatActivity() {
...
fun authenticate() {
...
if (session?.token != null) {
//HERE'S WHERE WE SAVE THE SESSION DAA
saveSessionData(session!!.name, session!!.token)
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
} else {
deliverAuthFailureMessage()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment