All Projects → ory → hydra-js

ory / hydra-js

Licence: other
DOES NOT WORK WITH VERSIONS > 0.10.0 - A simple library to help you build node-based identity providers that work with Hydra.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to hydra-js

React-Dark
A NPM module which allows you to add dark theme feature to your React application.
Stars: ✭ 19 (+11.76%)
Mutual labels:  npm-package
micro-signals
A tiny typed messaging system inspired by js-signals that uses ES2015 sets
Stars: ✭ 39 (+129.41%)
Mutual labels:  npm-package
eslint-plugin-todo-plz
Enforce consistent and maintainable TODO comments
Stars: ✭ 19 (+11.76%)
Mutual labels:  npm-package
specification
RDF vocabulary and specification
Stars: ✭ 21 (+23.53%)
Mutual labels:  hydra
MinifyAllCli
📦 A lightweight, simple and easy npm tool to 𝗺𝗶𝗻𝗶𝗳𝘆 JSON/C, HTML and CSS! Also known as MinifyAll core! ⭐ Usable as 𝑪𝑳𝑰 tool or 𝒊𝒎𝒑𝒐𝒓𝒕𝒂𝒃𝒍𝒆 in TS/JS as a 𝑴𝑶𝑫𝑼𝑳𝑬 🥰
Stars: ✭ 21 (+23.53%)
Mutual labels:  npm-package
stimulus-content-loader
A Stimulus controller to asynchronously load HTML from an url.
Stars: ✭ 39 (+129.41%)
Mutual labels:  npm-package
awesome-nodejs
Node.js 资源大全中文版。An awesome Node.js packages and resources
Stars: ✭ 978 (+5652.94%)
Mutual labels:  npm-package
eslint-plugin-vue-scoped-css
ESLint plugin for Scoped CSS in Vue.js
Stars: ✭ 58 (+241.18%)
Mutual labels:  npm-package
node-reactive-postgres
Reactive queries for PostgreSQL
Stars: ✭ 28 (+64.71%)
Mutual labels:  npm-package
ugql
🚀GraphQL.js over HTTP with uWebSockets.js
Stars: ✭ 27 (+58.82%)
Mutual labels:  npm-package
ng-charts
🎨📉 A fully functional Angular 14+ Chart.js library based from ng2-charts
Stars: ✭ 14 (-17.65%)
Mutual labels:  npm-package
arcscord
A Discord library written in typescript
Stars: ✭ 18 (+5.88%)
Mutual labels:  npm-package
node-eufy-api
A simple JavaScript API to control EufyHome (Anker) smart light bulbs, switches and plugs.
Stars: ✭ 22 (+29.41%)
Mutual labels:  npm-package
vue-package-template
Boilerplate for your next, ES6 Vue.js package. Ready for npm deployments
Stars: ✭ 12 (-29.41%)
Mutual labels:  npm-package
hydra-antlia
A collection of functions for Hydra
Stars: ✭ 45 (+164.71%)
Mutual labels:  hydra
fireworks-js
🎆 A simple fireworks library! Ready to use components available for React, Vue 3, Svelte, Angular, Preact, Solid, and Web Components.
Stars: ✭ 550 (+3135.29%)
Mutual labels:  npm-package
hydra-hpp
Hydra Hot Potato Player (game)
Stars: ✭ 12 (-29.41%)
Mutual labels:  hydra
js-mdict
*.mdx/*.mdd interpreter js implements
Stars: ✭ 91 (+435.29%)
Mutual labels:  npm-package
nba-stats-client
🏀 JavaScript Client for stats from NBA.com
Stars: ✭ 29 (+70.59%)
Mutual labels:  npm-package
2018-package-three-webpack-plugin
[ARCHIVED] Webpack plugin to use Three.js "examples" classes
Stars: ✭ 45 (+164.71%)
Mutual labels:  npm-package

hydra-js

Build Status Join the chat at https://gitter.im/ory/hydra Join mailinglist Join newsletter

Hydra is a runnable server implementation of the OAuth2 2.0 authorization framework and the OpenID Connect Core 1.0.

Deprecated with 0.10.0

This library is deprecated starting with version 0.10.0 of Hydra. Instead, a code generated (based on swagger) SDK is available in the main repository: https://ory.gitbooks.io/hydra/content/sdk/js.html

Overview

Hydra-js is a client library for javascript. It is currently available as an npm-module only. At this moment, Hydra-js primarily helps you with performing the consent validation. We welcome contributions that implement more of the Hydra HTTP REST API.

Installation

$ npm i --save hydra-js

Examples

Instantiating

var Hydra = require('hydra-js')

const config = {
 client: {
   id: process.env.HYDRA_CLIENT_ID, // id of the client you want to use, defaults to this env var
   secret: process.env.HYDRA_CLIENT_SECRET, // secret of the client you want to use, defaults to this env var
 },
 auth: {
   tokenHost: process.env.HYDRA_URL, // hydra url, defaults to this env var
   authorizePath: '/oauth2/auth', // hydra authorization endpoint, defaults to '/oauth2/auth'
   tokenPath: '/oauth2/token', // hydra token endpoint, defaults to '/oauth2/token'
 },
 scope: 'hydra.keys.get' // scope of the authorization, defaults to 'hydra.keys.get'
}

const hydra = new Hydra(config)

Getting an access token with the client_credentials flow

var Hydra = require('hydra-js')

const hydra = new Hydra(/* options */)
hydra.authenticate().then((token) => {
  // ...
}).catch((error) => {
  // ...
})

Consent flow

The following examples fetches the appropriate cryptographic keys and access tokens automatically, you basically need to do:

var Hydra = require('hydra-js')

const hydra = new Hydra(/* options */)

// verify consent challenge
hydra.verifyConsentChallenge(challenge).then(({ challenge: data }) => {
  // consent challenge is valid, render the consent screen:
  //  w.render('consent', { data })
}).catch((error) => {
  // error
})

// generate consent challenge
hydra.generateConsentResponse(challenge, subject, scopes, {}, data).then(({ consent }) => {
  // success! redirect back to hydra:
  //  w.redirect(challenge.redir + '&consent=' + consent)
}).catch((error) => {
  // error
})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].