File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,15 @@ class AuthManager: IterableAuthManagerProtocol {
95
95
private func onAuthTokenReceived( retrievedAuthToken: String ? , onSuccess: AuthTokenRetrievalHandler ? = nil ) {
96
96
pendingAuth = false
97
97
98
+ guard let authToken = authToken else {
99
+ delegate? . onTokenRegistrationFailed ( )
100
+
101
+ /// by default, schedule a refresh for 10s
102
+ scheduleAuthTokenRefreshTimer ( 10 )
103
+
104
+ return
105
+ }
106
+
98
107
authToken = retrievedAuthToken
99
108
100
109
storeAuthToken ( )
@@ -110,6 +119,8 @@ class AuthManager: IterableAuthManagerProtocol {
110
119
clearRefreshTimer ( )
111
120
112
121
guard let authToken = authToken, let expirationDate = AuthManager . decodeExpirationDateFromAuthToken ( authToken) else {
122
+ delegate? . onTokenRegistrationFailed ( )
123
+
113
124
/// schedule a default timer of 10 seconds if we fall into this case
114
125
scheduleAuthTokenRefreshTimer ( 10 )
115
126
Original file line number Diff line number Diff line change @@ -55,6 +55,13 @@ import Foundation
55
55
/// The delegate for getting the authentication token
56
56
@objc public protocol IterableAuthDelegate : AnyObject {
57
57
@objc func onAuthTokenRequested( completion: @escaping AuthTokenRetrievalHandler )
58
+ @objc func onTokenRegistrationFailed( )
59
+ }
60
+
61
+ extension IterableAuthDelegate {
62
+ func onTokenRegistrationFailed( ) {
63
+
64
+ }
58
65
}
59
66
60
67
/// Iterable Configuration Object. Use this when initializing the API.
You can’t perform that action at this time.
0 commit comments