uber / uber-ios-sdk

Uber iOS SDK (beta)
https://developer.uber.com/docs
MIT License
375 stars 125 forks source link

Logout API #315

Closed mohssenfathi closed 1 week ago

mohssenfathi commented 1 week ago

Description

Adding a new top-level API to UberAuth to "logout" the current user. This function deletes the stored auth token by:

  1. If UberAuth has a stored currentContext, calls the logout API on the currentContext
  2. If UberAuth does not have a stored currentContext, uses an internal TokenManager instance and deletes the token saved under the default identifier.

The equivalent API has been added to AuthorizationCodeAuthProvider to delete the token as described in (2).

After token deletion, UberAuth will release the stored currentContext.

Another computed property isLoggedIn was added for convenience to determine if a token exists in the keychain.

Changes

UberAuth API

Added new static and instance methods to UberAuth for logout as described above. Added computed isLoggedIn property to determine auth state.

AuthorizationCodeAuthProvider API

Added methods to AuthorizationCodeAuthProvider to delete the token for logout. Added computed isLoggedIn property to determine auth state.

Testing

Unit Tests

Added unit tests to ensure tokens are deleted and currentContext released properly

Manual Testing

Updated the UberSDK sample app to use the new APIs for manual testing.

https://github.com/user-attachments/assets/1aa82148-b370-4ba6-b3f7-bf64d9b8499c