Skip to content

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

Notifications You must be signed in to change notification settings

sketchfab/sketchfab-oauth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.2.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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published