GithubHelp home page GithubHelp logo

signicat-oidc-client's Introduction

Signicat OpenID Connect Provider

Signicat OpenID Connect Provider is a library to simplify implementation of it's SDK in NodeJS projects.

npm version

Installation

If you are using yarn package manager.

yarn install signicat-oidc-client

If you are using npm package manager.

npm i signicat-oidc-client

Usage

Fully working RunKIT example with express

Try signicat-oidc-client on RunKit

Redirect to our Auth endpoint

const signicat = require("signicat-oidc-client");

// Create an instance of SDK client
let client = signicat.Signicat.init('DFvfZ4bVE4tmoxjxjKm7L4uSOftBJYPL', 'hL_mqdzkDR7F-BrSUhPCfO8O1f02ZM1BLfFSF77LkcQZ4eEI5wH-xO4UlPxMPlfJ');

// Create params (nonce and state will be generated by SDK, you can allso pass them as arguments)
let params = signicat.Signicat.generateParams('https://your-callback-url/');

// Get redirect URI and redirect to this page
let redirectUrl = await client.getAuthorizationUrl(params);

Implementing callback return response with express

const signicat = require("signicat-oidc-client");

const { nonce, state } = req.session;
delete req.session.nonce;
delete req.session.state;

// Create an instance of SDK client
let client = signicat.Signicat.init('DFvfZ4bVE4tmoxjxjKm7L4uSOftBJYPL', 'hL_mqdzkDR7F-BrSUhPCfO8O1f02ZM1BLfFSF77LkcQZ4eEI5wH-xO4UlPxMPlfJ');

// Parsing callback params
let callbackParams = await client.getCallbackParams(req);

// Saving response to our session storage
req.session.user = await client.getAuthorizationCallback(CALLBACK_URL, callbackParams, {nonce, state, response_type: 'token id_token'});

// Now you can redirect to your 

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

signicat-oidc-client's People

Contributors

kamil-bednarek avatar

Watchers

Rafał Kotusiewicz avatar James Cloos avatar  avatar Wadim Grasza avatar Michał Kozłowski avatar Anton Rogachevskyi avatar Rafał Więcek avatar Adrian Jeż avatar Lukasz Odulinski avatar Jakub Bajorek avatar  avatar Mateusz Waszkiewicz avatar Remigiusz Orłowski avatar Rafal Malek avatar Mateusz Kuźmicz avatar AdrianBudzynski 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.