uber / uber-ios-sdk

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

Token Storage + UI #298

Closed mohssenfathi closed 6 months ago

mohssenfathi commented 6 months ago

Description

This PR does two main things:

  1. Adds a new TokenManager and supporting KeychainUtility so that we can save access tokens upon successful authentication.
  2. Adds replacement UI elements for the UberButton + LoginButton.

Changes

Supported platforms v13 -> v15

Bumped the minimum supported platform version to 15 to support the UIButton APIs. Platform adoption should be at a high enough level to support this. Also, this is in line with the 1P Uber app's min OS version.

AccessToken

A new AccessToken struct has be created to accompany the new Auth stack. The old one has been marked as DEPRECATED, but the logic should be similar.

Deprecated Classes

Legacy AccessToken and TokenManager have been marked as deprecated and call sites have been updated. There will be a later PR that migrates these call sites to the new classes.

Saving AccessToken

AuthorizationCodeAuthProvider now contains logic to save the AccessToken to the keychain after successfully exchanging authorization code for access token.

TokenManager + KeychainUtility

These are similar to the existing ones, with some improvements to the API. They now accept any objects conforming to the Codable protocol instead of NSCoding. Other logic should remain the same.

UberButton + LoginButton

The existing UberButton and LoginButton classes have been replaced with updated APIs that are now available. The UI and logic remains the same. Some resources including colors and images have been added to the bundle to support the new buttons.

Testing

Unit Tests

Unit tests have been added for new logic around token storage.

Manual Testing

The UberButton/LoginButton has been added to the sample app for manual testing purposes.