Sunday, December 15, 2024
HomeiOS Developmentswiftui - iOS App Authentication Shopper Aspect JWT Token Validation

swiftui – iOS App Authentication Shopper Aspect JWT Token Validation


I’m constructing an iOS app the place I’m doing JWT authentication. The token is generated on the server after which handed to the shopper (SwiftUI) app. The app saves the token in Keychain.

There are a number of locations within the app that requires authentication. How can I verify if the token remains to be legitimate (not expired). Presently, I’m decoding the token on the shopper after which checking the expiration date and for sources I’m checking and validating the token on the server.

The principle problem is that if I’m going to the profile display screen then I have to confirm that the token remains to be legitimate (not expired). The place would I put that code? If I put it within the profile display screen (View) then I’ve to place the identical code each view that requires a sound token.

I believe in React I used to be simply setting the isAuthenticated flag to true/false utilizing Redux state. What ought to I do in SwiftUI and iOS?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments