Always Learner
Always Learner

Reputation: 3016

Use navigation or display composable according to account verification state?

I have an app that uses authentication. When a user signs up, the requirement is to verify the account. In my current approach, as soon as the authentication is successful, I navigate the user to the profile screen. This screen contains two composables, one that displays a message that says that the account is not verified and one that displays profile data, if the account has been verified.

My question is, which approach is better in terms of arhitecture, navigate from SignInScreen to VerifyAccountScreen and then to ProfileScreen, or use navigation from SignInScreen to ProfileScreen and display data according to the account verification state?

Upvotes: 0

Views: 19

Answers (1)

IYCS
IYCS

Reputation: 23

In my opinion, the best approach will depend on your specific use case.

If the verification process is crucial for security, the second approach can help ensure that users are properly verified before accessing sensitive information.

If the verification process is simple (email verification), the first approach might be sufficient. For more complex scenarios (phone number verification, manual review), the second approach offers better control.

Or you can consider mixed approach

Initial Navigation to ProfileScreen show a clear message about the need for verification. Redirect to VerifyAccountScreen if the user tries to access sensitive features.

Upvotes: 0

Related Questions