OS.js is an open-source web desktop platform with a window manager, application APIs, GUI toolkit, filesystem abstractions and much more.
This is the Google API Provider for OS.js.
npm install @osjs/gapi-provider
In your client bootstrap file (src/client/index.js
):
import {GapiServiceProvider} from '@osjs/gapi-provider';
osjs.register(GapiServiceProvider, {
args: {
// These are set for you by default
src: 'https://apis.google.com/js/api.js',
libraries: 'client:auth2',
timeout: 30000,
// You have to define these
client: {
apiKey: '',
clientId: '',
discoveryDocs: [],
scope: []
}
}
});
For example in an application:
const osjsgapi = core.make('osjs/gapi').create();
osjsgapi.on('signed-in', () => console.log('You were signed in'));
osjsgapi.on('signed-out', () => console.log('You were signed out'));
osjsgapi.login().then(gapi => {
// Do whatever
});
proc.on('destroy', () => osjsgapi.destroy());
- Sponsor on Github
- Become a Patreon
- Support on Open Collective
- Contribution Guide
See the Official Manuals for articles, tutorials and guides.