cgalvan/amazon-location-mobile-auth-sdk-ios
Amazon Location Service Mobile Authentication SDK for iOS
These utilities help you authenticate when when making Amazon Location Service API calls from their iOS applications. This specifically helps when using Amazon Cognito as the authentication method.
Installation
- Go to File -> Add Package Dependencies in your XCode project.
- Type the package URL (https://github.com/aws-geospatial/amazon-location-mobile-auth-sdk-ios/) into the search bar and press the enter key.
- Select the "amazon-location-mobile-auth-sdk-ios" package and click on "Add Package".
- Select the "AmazonLocationiOSAuthSDK" package product and click on "Add Package".
Usage
After installing the library, import the AuthHelper class in an activity:
import AmazonLocationiOSAuthSDK
import AWSLocationXCFYou can create an AuthHelper and use it with the AWS SDK:
// Create an authentication helper using credentials from Cognito
func exampleCognitoLogin() {
let authHelper = AuthHelper()
let locationCredentialsProvider = authHelper.authenticateWithCognitoIdentityPool(identityPoolId: "My-Cognito-Identity-Pool-Id", region: "us-east-1")
let locationClient = authHelper.getLocationClient()
}// Create an authentication helper using credentials from any AWS-Swift-SDK [Credentials Provider](https://github.com/awslabs/aws-crt-swift/blob/main/Source/AwsCommonRuntimeKit/auth/credentials/CredentialsProvider.swift)
func exampleCognitoLogin() {
let authHelper = AuthHelper()
let credentialProvider = try CredentialsProvider(source: .static(accessKey: "My-AWS-AccessKey", secret: "My-AWS-Secret", sessionToken: "My-AWS-SessionToken", shutdownCallback: {/*Perform post shutdown operation here*/}))
let locationCredentialsProvider = authHelper.authenticateWithCredentialsProvider(credentialsProvider: credentialProvider)
let locationClient = authHelper.getLocationClient()
}Security
See CONTRIBUTING for more information.
Getting Help
The best way to interact with our team is through GitHub.
You can open an issue and choose from one of our templates for
bug reports,
feature requests
or guidance.
If you have a support plan with AWS Support, you can also create a new support case.
Contributing
We welcome community contributions and pull requests. See CONTRIBUTING.md for information on how to set up a development environment and submit code.
License
The Amazon Location Service Mobile Authentication SDK for iOS is distributed under the
Apache License, Version 2.0,
see LICENSE.txt and NOTICE.txt for more information.