Skip to content

Commit

Permalink
Upgrade Login with Amazon SDK to 3.1.0 version
Browse files Browse the repository at this point in the history
  • Loading branch information
densa committed Oct 7, 2020
1 parent acb066e commit 9288ec0
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 122 deletions.
Binary file modified android/libs/login-with-amazon-sdk.jar
Binary file not shown.
Expand Up @@ -98,7 +98,7 @@ typedef void (^AMZNSignOutRequestHandler)(NSError * _Nullable error);
@since 3.0
*/
+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication;
+ (BOOL)handleOpenURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication;

@end
NS_ASSUME_NONNULL_END
Expand Down
Expand Up @@ -8,8 +8,8 @@

#import <Foundation/Foundation.h>

#import "AIExchangeRequest.h"
#import "AMZNLWAExchangeRequest.h"

@interface AMZNCodePairRequest : AIExchangeRequest
@interface AMZNCodePairRequest : AMZNLWAExchangeRequest

@end
Expand Up @@ -12,26 +12,26 @@

#import <Foundation/Foundation.h>

@class AIError;
@class AMZNLWAError;

#pragma mark - API

/**
These constants identify which API succeeded or failed when calling AIAuthenticationDelegate. The value identifying
These constants identify which API succeeded or failed when calling AMZNLWAAuthenticationDelegate. The value identifying
the API is passed in the APIResult and APIError objects.
@since 1.0
*/
typedef NS_ENUM(NSUInteger, API) {
/** Refers to `[AIMobileLib authorizeUserForScopes:delegate:]` */
/** Refers to `[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` */
kAPIAuthorizeUser = 1,
/** Refers to `[AIMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]` */
/** Refers to `[AMZNLWAMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]` */
kAPIGetAccessToken = 2,
/** Refers to `[AIMobileLib clearAuthorizationState:]` */
/** Refers to `[AMZNLWAMobileLib clearAuthorizationState:]` */
kAPIClearAuthorizationState = 3,
/** Refers to `[AIMobileLib getProfile:]` */
/** Refers to `[AMZNLWAMobileLib getProfile:]` */
kAPIGetProfile = 4,
/** Refers to `[AIMobileLib authorizeUserForScopes:delegate:options]` */
/** Refers to `[AMZNLWAMobileLib authorizeUserForScopes:delegate:options]` */
kAPIGetAuthorizationCode = 5,
/** Refers to [AMZNCodePairManager getCodePair]' */
kAPIGetCodePair = 6,
Expand All @@ -41,7 +41,7 @@ typedef NS_ENUM(NSUInteger, API) {

#pragma mark - APIResult
/**
This class encapsulates success information from an AIMobileLib API call.
This class encapsulates success information from an AMZNLWAMobileLib API call.
*/
@interface APIResult : NSObject

Expand All @@ -51,11 +51,11 @@ typedef NS_ENUM(NSUInteger, API) {
The result object returned from the API on success. The API result can be `nil`, an `NSDictionary`, or an `NSString`
depending upon which API created the APIResult.
- `[AIMobileLib authorizeUserForScopes:delegate:]` : Passes `nil` as the result to the delegate.
- `[AIMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]` : Passes an access token as an `NSString` object
- `[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` : Passes `nil` as the result to the delegate.
- `[AMZNLWAMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]` : Passes an access token as an `NSString` object
to the delegate.
- `[AIMobileLib clearAuthorizationState:]` : Passes nil as the result to the delegate.
- `[AIMobileLib getProfile:]` : Passes profile data in an `NSDictionary` object to the delegate. See the API description
- `[AMZNLWAMobileLib clearAuthorizationState:]` : Passes nil as the result to the delegate.
- `[AMZNLWAMobileLib getProfile:]` : Passes profile data in an `NSDictionary` object to the delegate. See the API description
for information on the key:value pairs expected in profile dictionary.
@since 1.0
Expand All @@ -74,7 +74,7 @@ typedef NS_ENUM(NSUInteger, API) {
#pragma mark - APIError

/**
This class encapsulates the failure result from an AIMobileLib API call.
This class encapsulates the failure result from an AMZNLWAMobileLib API call.
*/
@interface APIError : NSObject

Expand All @@ -83,11 +83,11 @@ typedef NS_ENUM(NSUInteger, API) {
/**
The error object returned from the API on failure.
@see See AIError for more details.
@see See AMZNLWAError for more details.
@since 1.0
*/
@property (strong) AIError *error;
@property (strong) AMZNLWAError *error;

/**
The API which is returning the error.
Expand All @@ -98,12 +98,12 @@ typedef NS_ENUM(NSUInteger, API) {

@end

#pragma mark - AIAuthenticationDelegate
#pragma mark - AMZNLWAAuthenticationDelegate
/**
Applications calling AIMobileLib APIs must implement the methods of this protocol to receive success and failure
Applications calling AMZNLWAMobileLib APIs must implement the methods of this protocol to receive success and failure
information.
*/
@protocol AIAuthenticationDelegate <NSObject>
@protocol AMZNLWAAuthenticationDelegate <NSObject>

@required

Expand Down
Expand Up @@ -17,70 +17,70 @@
/**
Login With Amazon error domain for NSErrors
*/
FOUNDATION_EXPORT NSString *const AIErrorDomain;
FOUNDATION_EXPORT NSString *const kAMZNLWAErrorDomain;

#pragma mark - Error codes

/**
No error, initial value.
*/
extern const NSUInteger kAINoError;
extern const NSUInteger kAMZNLWANoError;

/**
A valid refresh token was not found.
The refresh token stored in the SDK is invalid, expired, revoked, does not match
the redirection URI used in the authorization request, does not have the required scopes, or was issued to another
client. `[AIMobileLib getProfile:]` and `[getAccessTokenForScopes:withOverrideParams:delegate:]` can return this
client. `[AMZNLWAMobileLib getProfile:]` and `[getAccessTokenForScopes:withOverrideParams:delegate:]` can return this
error.
Generally with this type of error, the app can call `[AIMobileLib authorizeUserForScopes:delegate:]` to request
authorization, or call `[AIMobileLib clearAuthorizationState:]` to logout the user.
Generally with this type of error, the app can call `[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` to request
authorization, or call `[AMZNLWAMobileLib clearAuthorizationState:]` to logout the user.
*/
extern const NSUInteger kAIApplicationNotAuthorized;
extern const NSUInteger kAMZNLWAApplicationNotAuthorized;

/**
An error occurred on the server.
The server encountered an error while completing the request, or the SDK received an unknown response from the server.
`[AIMobileLib getProfile:]`, `[AIMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AIMobileLib authorizeUserForScopes:delegate:]` can return this error.
`[AMZNLWAMobileLib getProfile:]`, `[AMZNLWAMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can return this error.
Generally with this type of error, the app can allow the user to retry the last action.
*/
extern const NSUInteger kAIServerError;
extern const NSUInteger kAMZNLWAServerError;

/**
The user dismissed the page.
The user pressed cancel while on an Amazon-provided page, such as login or consent.
`[AIMobileLib authorizeUserForScopes:delegate:]` can return this error.
`[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can return this error.
Generally with this type of error, the app can allow the user to perform the requested operation again.
*/
extern const NSUInteger kAIErrorUserInterrupted;
extern const NSUInteger kAMZNLWAErrorUserInterrupted;

/**
The resource owner or authorization server denied the request.
The user declined to authorize the app on the consent page. `[AIMobileLib authorizeUserForScopes:delegate:]` can
The user declined to authorize the app on the consent page. `[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can
return this error.
Generally with this type of error, the app can call `[AIMobileLib authorizeUserForScopes:delegate:]` to
Generally with this type of error, the app can call `[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` to
request authorization.
*/
extern const NSUInteger kAIAccessDenied;
extern const NSUInteger kAMZNLWAAccessDenied;

/**
The SDK encountered an error on the device.
The SDK returns this when there is a problem with the Keychain. `[AIMobileLib getProfile:]`,
`[AIMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AIMobileLib authorizeUserForScopes:delegate:]` can return this error.
The SDK returns this when there is a problem with the Keychain. `[AMZNLWAMobileLib getProfile:]`,
`[AMZNLWAMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can return this error.
Generally with this type of error, the app can call `[AIMobileLib clearAuthorizationState:]` to reset the Keychain.
Generally with this type of error, the app can call `[AMZNLWAMobileLib clearAuthorizationState:]` to reset the Keychain.
*/
extern const NSUInteger kAIDeviceError;
extern const NSUInteger kAMZNLWADeviceError;

/**
One of the API parameters is invalid.
Expand All @@ -90,51 +90,58 @@ extern const NSUInteger kAIDeviceError;
Check your method parameters and try again. All APIs can return this error.
*/
extern const NSUInteger kAIInvalidInput;
extern const NSUInteger kAMZNLWAInvalidInput;

/**
A network error occurred, possibly due to the user being offline.
`[AIMobileLib getProfile:]`, `[AIMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AIMobileLib authorizeUserForScopes:delegate:]` can return this error.
`[AMZNLWAMobileLib getProfile:]`, `[AMZNLWAMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can return this error.
Generally with this type of error, the app can ask the user to check their network connections.
*/
extern const NSUInteger kAINetworkError;
extern const NSUInteger kAMZNLWANetworkError;

/**
The client is not authorized to request an authorization code using this method.
The app is not authorized to make this call. Make sure the registered Bundle identifier matches your app, and that you
have a valid APIKey property in the app property list.
`[AIMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AIMobileLib authorizeUserForScopes:delegate:]` can return this error.
`[AMZNLWAMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can return this error.
*/
extern const NSUInteger kAIUnauthorizedClient;
extern const NSUInteger kAMZNLWAUnauthorizedClient;

/**
An internal error occurred in the SDK.
`[AIMobileLib getProfile:]`, `[AIMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AIMobileLib authorizeUserForScopes:delegate:]` can return this error.
`[AMZNLWAMobileLib getProfile:]`, `[AMZNLWAMobileLib getAccessTokenForScopes:withOverrideParams:delegate:]`, and
`[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can return this error.
Generally these errors cannot be handled by app. Please contact us to report recurring internal errors.
*/
extern const NSUInteger kAIInternalError;
extern const NSUInteger kAMZNLWAInternalError;

/**
An version error occurred while the SDK version is not supported for LWA SSO.
Only `[AIMobileLib authorizeUserForScopes:delegate:]` can return this error.
Only `[AMZNLWAMobileLib authorizeUserForScopes:delegate:]` can return this error.
*/
extern const NSUInteger kAIVersionDenied;
extern const NSUInteger kAMZNLWAVersionDenied;

#pragma mark - AIError
/// @name userinfo keys

/**
This class encapsulates the error information generated by the SDK. An AIError object includes the error code and a
NSTimeInterval time until next retry attempt is added to errors of type kAMZNLWAServerError in which the server is currently unavailable and in backoff interval
*/
extern NSString *const kAMZNLWAErrorTimeUntilNextRetryAttempt;

#pragma mark - AMZNLWAError

/**
This class encapsulates the error information generated by the SDK. An AMZNLWAError object includes the error code and a
meaningful error message. The error code constants are available in the header file.
*/
@interface AIError : NSObject
@interface AMZNLWAError : NSObject

/**
The error code for the error encountered by the API.
Expand All @@ -157,4 +164,12 @@ extern const NSUInteger kAIVersionDenied;
*/
@property (copy) NSString *message;

/**
Additional info which may be used to describe the error further.
@since 3.1.1
*/

@property NSDictionary *userInfo;

@end

0 comments on commit 9288ec0

Please sign in to comment.