Giter Site home page Giter Site logo

dariusbakunas / appid-clientsdk-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibm-cloud-security/appid-clientsdk-js

0.0 2.0 0.0 607 KB

Client-side javascript SDK for the IBM Cloud App ID service

License: Apache License 2.0

JavaScript 100.00%

appid-clientsdk-js's Introduction

Codacy Badge

IBM Cloud App ID JavaScript SDK

Client-side javascript SDK for the IBM Cloud App ID service to use with single-page applications created in Angular, React, or other frontend frameworks. Read the documentation for information on getting started with IBM Cloud App ID and single-page applications. Apps using Node.js should use our server-side SDK.

Table of Contents

Installation

Using npm:

npm install ibmcloud-appid-js
import AppID from 'ibmcloud-appid-js';

From the CDN:

<script src="https://cdn.appid.cloud.ibm.com/appid-0.4.1.min.js"></script>

Or for development purposes use the minified file in this repo:

<script type='text/javascript' src="dist/appid.min.js"></script>

Getting Started

A sample application can be found in the sample folder in this repo.

You will need an IBM Cloud App ID instance with a singlepageapp application created. Apps using Angular, React, or other frontend frameworks will require a specific type of credentials to use with IBM Cloud App ID. Visit the docs to learn more about creating application credentials.

Use the clientId and discoveryEndpoint from the application credentials to initialize the AppID instance.

const appID = new AppID();
await appID.init({
    clientId: '<SPA_CLIENT_ID>',
    discoveryEndpoint: '<WELL_KNOWN_ENDPOINT>'
});

Using the signin() in your app to start authentication:

document.getElementById('login').addEventListener('click', async () => {
    try {
        const tokens = await appID.signin();
    } catch (e) {
        ...
    }
});

Read the documentation for information about getting started with IBM Cloud App ID Service.

API Reference

Checkout our API reference here.

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.