Skip to content

Commit 412320a

Browse files
author
Aidan Laing
committed
Read Me Refresh Token
1 parent 62f4482 commit 412320a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?)
8989

9090
### Get Token
9191
Get token will get the token from local storage.
92+
9293
If the token is expired and the refresh token is NOT expired the token will automatically be refreshed, saved locally and returned.
9394

9495
Exceptions:
@@ -119,7 +120,11 @@ client?.getToken(object: MobileAuthenticationClient.TokenCallback {
119120
})
120121
```
121122

123+
### Refresh Token
124+
Refresh token will refresh the locally stored token.
122125

123-
126+
Exceptions:
127+
1. If the token's refresh token is expired a `RefreshExpiredException` will be thrown in the onError of the TokenCallback. In this case the user will need to reauthenticate.
128+
2. If the token does not have a refresh token then a `NoRefreshTokenException` will be thrown in the onError of the TokenCallback. This means the Token data being returned does not contain the required refreshToken for this lib to work.
124129

125130

app/src/main/java/ca/bc/gov/mobileauthenticationandroidexample/MainActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class MainActivity : AppCompatActivity() {
6767
}
6868

6969
override fun onSuccess(token: Token) {
70-
Log.d(tag, "Get Success")
70+
Log.d(tag, "Get Token Success")
7171
refreshToken()
7272
}
7373
})
@@ -88,7 +88,7 @@ class MainActivity : AppCompatActivity() {
8888
}
8989

9090
override fun onSuccess(token: Token) {
91-
Log.d(tag, "Refresh Success")
91+
Log.d(tag, "Refresh Token Success")
9292
deleteToken()
9393
}
9494
})
@@ -101,7 +101,7 @@ class MainActivity : AppCompatActivity() {
101101
}
102102

103103
override fun onSuccess() {
104-
Log.d(tag, "Delete Success")
104+
Log.d(tag, "Delete Token Success")
105105
}
106106
})
107107
}

0 commit comments

Comments
 (0)