# ulbora-oauth2

> Ulbora Oauth2 =============

Latest version **1.0.0** (published 2017-04-23) · 0 weekly downloads

## Install

```sh
npm install ulbora-oauth2
pnpm add ulbora-oauth2
yarn add ulbora-oauth2
bun add ulbora-oauth2
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-04-23 |
| First published | 2017-04-23 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ken |
| Maintainers | kenwilliamson |
| Keywords | oauth, oauth2, ulbora, oauth2 client |

## Links

- npm: https://www.npmjs.com/package/ulbora-oauth2
- Repository: https://github.com/Ulbora/ulbora-oauth2
- Homepage: https://github.com/Ulbora/ulbora-oauth2#readme
- Issues: https://github.com/Ulbora/ulbora-oauth2/issues
- npm.io page: https://npm.io/package/ulbora-oauth2

## Dependencies (1)

- [request](https://npm.io/package/request.md) ~2.81.0

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-04-23

## README

Ulbora Oauth2 
=============

ulbora-oauth2 is an Oauth2 node module for use with token validation built in [Ulbora Oauth2 Server](https://github.com/Ulbora/nodeJsOauth2Server).
The module makes securing REST services easy.

## Using

```
var oauth2 = require("ulbora-oauth2");
var mailManager = require("../managers/mailManager");
// a local version of Ulbora Oauth2 Server 
var validationUrl = "https://localhost:3000/rs/token/validate";

exports.sendMail = function (req, res) {
    if (req.is('application/json')) {
        // The url of the particular REST service must be mapped 
        // in the Ulbora Oauth2 Server to the role specified 
        // and the scope specified when scope is used.
        // If the url isn't mapped to the role and scope, a 401 will be sent.
        // If no url or role are passed, a 401 will be sent.
        // This provides an added level of security.
        var me = {
            role: "admin",
            uri: "/rs/mail/send",
            scope: "write"
        };
        oauth2.authorize(req, res, me, validationUrl, function () {
            var reqBody = req.body;
            var bodyJson = JSON.stringify(reqBody);
            console.log("body: " + bodyJson);
            mailManager.sendMail(reqBody, function (result) {
                res.send(result);
            });
        });
    } else {
        res.status(415);
        res.send({success: false});
    }
};


```

---
_Source: https://npm.io/package/ulbora-oauth2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
