Giter VIP home page Giter VIP logo

cordova-plugin-amazon-login's Introduction

Cordova Plugin Login with Amazon

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.

##Prerequisites

Android

  • Download the Amazon Mobile App SDK and extract the files to a directory on your hard drive.
  • You should see a login-with-amazon.jar file in the LoginWithAmazon parent directory.
  • Copy login-with-amazon.jar file to platforms/android/libs/login-with-amazon.jar of your Cordova project.
  • Create configuration file for Amazon API keys config\project.json
  • If you do not have your API Key yet, see Android App Signatures and API Keys and follow the instructions under "Retrieving an Android API Key".
  • Set your Amazon API keys in config\project.json

For example, your config\project.json might look like this:

{
  "debug":
  {
    "AMAZON_API_KEY" : "hdgGHHDG......8yRM=="
  },
  "release":
  {
    "AMAZON_API_KEY" : "dh8HGuDQ......rt5H=="
  }
}

By default, the value of API key from debug section will be used. In order to use API key from release section

TARGET=release cordova prepare

iOS

  • If you have not installed Xcode, you can get it from https://developer.apple.com/xcode.
  • Download the [Amazon Mobile App SDK] (https://developer.amazon.com/public/resources/development-tools/sdk) and extract the files to a directory on your hard drive.
  • You should see a LoginWithAmazon.framework directory in the LoginWithAmazon parent directory. This contains the Login with Amazon library.
  • With your project open in Xcode, select the Frameworks folder, then click File from the main menu and select Add Files to "project". In the dialog, select LoginWithAmazon.framework and click Add.
  • Select Build Settings. Click All to view all settings.
  • Under Search Paths, ensure that the LoginWithAmazon.framework directory is in the Framework Search Paths. For example:
  • In the main menu, click Product and select Build. The build should complete successfully.
  • Add a URL Scheme to Your App Property List
  • Get Amazon API key for your iOS app

Installation

cordova plugin add https://github.com/edu-com/cordova-plugin-amazon-login.git#v2.0.0 --variable IOS_API_KEY="your-key-here"

API

Authorize

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.

FetchUserProfile

TBD

GetToken

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.

SignOut

window.AmazonLogin.signOut(Function success, Function failure)

cordova-plugin-amazon-login's People

Contributors

denisura avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-amazon-login's Issues

Object options

hi,

had you an example of options to use
window.AmazonLogin.authorize(Object options, Function success, Function failure)

username and password ?

update to new version

This plugin unable to install.

Failed to install 'cordova-plugin-amazon-login': Error: ENOENT: no such file or directory, open '/Applications/MAMP/htdocs/cordova/xxxxxx/platforms/android/AndroidManifest.xml'

amazon LWA SDK can't find api_key.txt

com.amazon.identity.auth.device.utils.ThirdPartyResourceParser: Unable to get api key asset document: api_key.txt

I see that ap_key.txt is indeed being written to platforms/android/assets/api_key.txt per after_prepare.js, but for some reason, cordova isn't placing it where the AWS LWA code can find it.

Any thoughts?
Thanks!
Chris

Cordova plugin for iOS

Hi,
I am trying to install this plugin for my cordova iOS and Android project for integrating amazon AVS. After adding the LWA framework in IOS project and the updated the build settings , I am not able to add as a plugin.how to add LWA as a cordova plugin?

cordova plugin add ~/workspace/edu-com/cordova-plugin-amazon-login --variable IOS_API_KEY="blah" - please guide

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.