Coder Social home page Coder Social logo

chrome-cordova-identity's Introduction

chrome.identity Plugin

This plugin provides OAuth2 authentication for Android and iOS.

On Android, this plugin uses Google Play Services; on iOS, it uses InAppBrowser.

Status

Stable on Android; alpha on iOS.

Reference

The API reference is here; a description of how to use the API is here.

Preparing Your Application

Android

You will need to register your application in the Google Cloud Console. Create a project.

On the left sidebar, navigate to "APIs & Auth" > "Registered Apps". Click the red Register App button.

Register your app as an "Android" app. This requires a package name and a SHA1 fingerprint. To obtain the fingerprint, enter the following the command in a console window:

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore -list -v

(On Windows, replace ~ with %USERPROFILE%.)

You will be prompted for a password, which is android.

This process will yield a client id, but no action is required with it (unlike for iOS).

iOS

For iOS, first follow Step 1 of the instructions here.

Note: If you change your app's bundle identifier at any time, you will need to correspondingly update the bundle identifier in the following places:

  • the Google Cloud Console, under "APIs & Auth" > "Registered Apps", and
  • your app's URL types in Xcode (located in the app's Info tab).

Updating Your Manifest

Your manifest needs to be updated to include your client id and scopes. In a Chrome App, this is done in manifest.json as follows:

"oauth2": {
  "client_id": "YOUR_IOS_CLIENT_ID",
  "scopes": [
    "SCOPE_1",
    "SCOPE_2",
    "SCOPE_3"
  ]
},

When using this plugin outside the context of a Chrome App, this information must be provided using chrome.runtime.setManifest:

chrome.runtime.setManifest({
  oauth2: {
    client_id: 'YOUR_IOS_CLIENT_ID',
    scopes: [ 'SCOPE_1', 'SCOPE_2', 'SCOPE_3' ]
  }
});

Playing With Google APIs

The Google APIs Explorer is a useful tool for determining required scopes and testing various API use cases.

chrome-cordova-identity's People

Watchers

 avatar  avatar  avatar

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.