# @sketchfab/oauth2

> A JavaScript browser library for connecting to a Sketchfab account with OAuth2

Latest version **1.1.0** (published 2021-11-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install @sketchfab/oauth2
pnpm add @sketchfab/oauth2
yarn add @sketchfab/oauth2
bun add @sketchfab/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.1.0 |
| Published | 2021-11-04 |
| First published | 2021-11-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 159.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sketchfab |
| Maintainers | pierreant-p, arthurjamain, sketchfab-npm-publisher |

## Links

- npm: https://www.npmjs.com/package/@sketchfab/oauth2
- npm.io page: https://npm.io/package/@sketchfab/oauth2

## Dependencies (1)

- [when](https://npm.io/package/when.md) ^3.7.7

## Recent versions

- 1.1.0 (latest) — 2021-11-04
- 1.2.0 — 2021-11-04

## README

# SketchfabOAuth2

SketchfabOAuth2 is a JS browser library for connecting to a Sketchfab account with OAuth2.
This library only support the [Implicit flow](https://sketchfab.com/developers/oauth#implement-implicit).

## Usage

To use OAuth2, you need to register your app on Sketchfab.

Insert the script in your HTML page

```html
<script src="../dist/sketchfab-oauth2-1.1.0.js" type="text/javascript"></script>
```

Here's how to use the library:

```js
var config = {
    hostname: 'sketchfab.com',
    client_id: 'INSERT_YOUR_CLIENT_ID_HERE',
    redirect_uri: 'http://example.com/authSuccess.html'
};

var client = new SketchfabOAuth2( config );

client.connect().then( function onSuccess( grant ) {
    console.log( grant );
} ).catch( function onError( error ) {
    console.error( error );
} );
```

## Development

* `npm install`
* Source is in `src`
* Run `npm run build` to build the browser library

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