Skip to content

Commit

Permalink
Update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
itaihanski committed Nov 17, 2024
1 parent 8b9b7fe commit 3ee2d93
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion descopesdk/src/main/java/com/descope/sdk/Routes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,28 @@ interface DescopeAuth {
fun refreshSession(refreshJwt: String, callback: (Result<RefreshResponse>) -> Unit)

/**
* Logs out from an active [DescopeSession].
* It's a good security practice to remove refresh JWTs from the Descope servers if
* they become redundant before expiry. This function will usually be called with `.currentSession`
* when the user wants to sign out of the application. For example:
*
*
* fun onSignOut() {
* // clear the session locally from the app and revoke the refreshJWT
* // from the Descope servers in a coroutine scope without waiting for the call to finish
* Descope.sessionManager.session?.refreshJwt?.run {
* Descope.sessionManager.clearSession()
* GlobalScope.launch(Dispatchers.Main) { // This can be whatever scope makes sense for your app
* try {
* Descope.auth.revokeSessions(RevokeType.CurrentSession, refreshJwt)
* } catch (e: Exception){
* }
* }
* }
* showLaunchScreen()
* }
*
* - Important: When called with `RevokeType.AllSessions` the provided refresh JWT will not
* be usable anymore and the user will need to sign in again.
*
* @param revokeType which sessions should be removed by this call.
* - `CurrentSession`: log out of the current session (the one provided by this refresh JWT)
Expand Down
2 changes: 1 addition & 1 deletion descopesdk/src/main/java/com/descope/types/Others.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.descope.session.DescopeSession
// Enums

/**
* Which sessions to revoke when calling `DescopeAuth.RevokeType()`
* Which sessions to revoke when calling `DescopeAuth.revokeSessions()`
*/
enum class RevokeType {
/** Revokes the provided refresh JWT. */
Expand Down

0 comments on commit 3ee2d93

Please sign in to comment.