This fork aims to simplify Amazon's AVS Authorization Mechanism.
The setup from the original plugin has also been greatly simplified by:
- baking in both Android and iOS LWA libraries
- updating the plugin config to include automatable steps
- adding cordova hooks for copying API Keys at the prepare step
NOTE: The android APIs are targeted for cordova-android 7+
A Cordova Plugin for Login with Amazon. Use your Amazon account to authenticate with the app. This plugin is a wrapper around native android and iOS libraries developed by Amazon.
-
Amazon API keys for both iOS and Android
-
Configuration file for Amazon API keys at the root of your project named
amazon-login.config.json
, which should have this format:
{
"android": {
"debug": {
"api_key": "eyJhbGc...NHGGqug=="
},
"release": {
"api_key": "eyJhbGc...DFthdeg=="
}
},
"ios": {
"api_key": "eyJhbGc...WyRg=="
}
}
NOTE:
By default, the value of API key from debug
section will be used for Android.
In order to use API key from release
section
TARGET=release cordova prepare
cordova plugin add https://github.com/jospete/cordova-plugin-amazon-login.git#release/3.0.3
window.AmazonLogin.authorize(Object options, Function success, Function failure)
Success function returns an Object like:
{
accessToken: "...",
user: {
name: "Full Name",
email: "[email protected]",
user_id: "634565435",
postal_code: '12345'
}
}
Failure function returns an error String.
window.AmazonLogin.authorizeAVS(Object options, Function success, Function failure)
Success function returns an Object like:
{
accessToken: "...",
authorizationCode: "...",
clientId: "...",
redirectUri: "...",
user: {
name: "Full Name",
email: "[email protected]",
user_id: "634565435",
postal_code: '12345'
}
}
Failure function returns an error String.
window.AmazonLogin.authorizeAVS(Function success, Function failure)
Success function returns an Object like:
{
name: "Full Name",
email: "[email protected]",
user_id: "634565435",
postal_code: '12345'
}
Failure function returns an error String.
window.AmazonLoginPlugin.getToken(Object options,Function success, Function failure)
Success function returns an Object like:
{
accessToken: "...",
user: {
name: "Full Name",
email: "[email protected]",
user_id: "634565435",
postal_code: '12345'
}
}
Failure function returns an error String.
window.AmazonLogin.signOut(Function success, Function failure)
NOTE: API Key registration is defined at step 3 in each of the iOS and Android LWA Docs