@sketchfab/oauth2

1.1.0 • Public • Published

SketchfabOAuth2

SketchfabOAuth2 is a JS browser library for connecting to a Sketchfab account with OAuth2. This library only support the Implicit flow.

Usage

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

Insert the script in your HTML page

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

Here's how to use the library:

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

Readme

Keywords

none

Package Sidebar

Install

npm i @sketchfab/oauth2

Weekly Downloads

14

Version

1.1.0

License

ISC

Unpacked Size

163 kB

Total Files

9

Last publish

Collaborators

  • pierreant-p
  • arthurjamain
  • sketchfab-npm-publisher