# uconn-sso-client

> A simple SSO client to interact with UCONN's CAS server to sign in with NetID in your webapp

Latest version **1.1.9** (published 2023-11-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install uconn-sso-client
pnpm add uconn-sso-client
yarn add uconn-sso-client
bun add uconn-sso-client
```

## 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.1.9 |
| Published | 2023-11-05 |
| First published | 2023-09-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Matt Beauvais |
| Maintainers | mattb102 |
| Keywords | UCONN, CAS, SSO |

## Links

- npm: https://www.npmjs.com/package/uconn-sso-client
- npm.io page: https://npm.io/package/uconn-sso-client

## Dependencies (2)

- [xml2js](https://npm.io/package/xml2js.md) ^0.6.2
- [build-url](https://npm.io/package/build-url.md) ^6.0.1

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.1.9 (latest) — 2023-11-05
- 1.1.8 — 2023-10-30
- 1.1.7 — 2023-10-30
- 1.1.6 — 2023-10-30
- 1.1.5 — 2023-10-30
- 1.1.4 — 2023-10-30
- 1.1.3 — 2023-10-16
- 1.1.2 — 2023-10-16
- 1.1.1 — 2023-10-09
- 1.1.0 — 2023-10-09
- 1.0.9 — 2023-10-09
- 1.0.7 — 2023-10-09
- 1.0.6 — 2023-10-08
- 1.0.5 — 2023-10-08
- 1.0.4 — 2023-10-08
- … 4 more at https://npm.io/package/uconn-sso-client/versions

## README

# uconn-sso-client
by Matt Beauvais

# Installation
Install the package via npm:
`npm install uconn-sso-client`

Then import it in your code:
```js
import  UconnCasClient  from  'uconn-sso-client';
```

# Usage
```js
const casClient = new UconnCasClient
casClient.auth()
  .then(async (netID: string) => {
    // success!
    console.log(netID)
    // do whatever you need to do
 })
  .catch((error: any) => {
    // failure!
    console.log("NetID Auth Failed")
    // handle error
})
```

You wil need to run the auth function twice. The first call to auth will redirect the user to the NetID sign in page to enter their credentials (or, if the person already has signed into NetID before, this will be skipped). They will then be redirected back to your app with a service and ticket parameter in the url. The second time should be run after the redirect when the ticket and service and supplied in your URL, this time the function will validate the ticket with UCONN's server. An example of this is with a useEffect in react to automatically run the function again if the ticket and service params are supplied on whatever page you handle logging in on:
```js
useEffect(() => {
    // code to run after render goes here
    const queryParameters = new URLSearchParams(window.location.search);
    if (queryParameters.get("ticket") && queryParameters.get("status")) {
      // call your auth function
    }
  }
```

# Notes

This is still a very early version, so I will work to improve this to make it easier to use and also better handle any sort of failures. I am also open to any PR's

# Resources

See: https://iam.uconn.edu/the-cas-protocol-for-application-owners/ for UCONN's overview of CAS. You should have a basic understanding on how this works before using this module

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