Question

I'm starting a new project in iOS7 and i need to implement OAuth 2 protocol to login.

I understand that OAuth 2 define that i need to store the token & refresh token to access to the resources in the server, and when i do the logout it must revoke this token in the server and delete it from the keychain right?.

My question is what is the proper way to accomplish it, i have this example flow in storyboard:

enter image description here

Correct me if i'm wrong:

  • In the "splash screen" VC i need to validate the token or refresh it right? or in some other point?
  • If the token is valid i need to "popup" or "push" the Tabbar VC ?
  • If the token isn't valid i need tu "popup" or "push" the login VC?
    • When i have a success login i need to "popup" or "push" the Tabbar VC ?
  • And the last case, when the user press "Logout", what i must to do? push to Login VC? what about memory ? i mean, i know in storyboard when u "navigate" you allocate every child vc in the memory, and it increase right? how i "restart" everything to the initial state of the app ?

PS: My questions are about the Storyboard flow not about OAuth 2 PS2: Sorry for my english, any corrections please tell me.

Was it helpful?

Solution

  1. Yes, at splash screen you should validate/refresh token.
  2. You should "push" to tabbar VC by embedding a Navigation Controller.
  3. Again same for your third question, you should "push" in both conditions.
  4. During logout just "push" back to LoginVC and about memory don't worry much about it if you have enabled ARC, xcode is pretty clever about allocing & deallocing.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top