npm install strapi-sdk-javascriptimportStrapifrom'strapi-sdk-javascript';conststrapi=newStrapi('http://localhost:1337');awaitstrapi.login('username_or_email','s3cr3t');// Redirect your user to the provider's authentication page.window.location=strapi.getProviderAuthenticationUrl('facebook');Once authorized, the provider will redirects the user to your app with an access token in the URL.
// Complete the authentication: (The SDK will store the access token for you)awaitstrapi.authenticateProvider('facebook');You can now fetch private APIs
constposts=awaitstrapi.getEntries('posts');constform=newFormData();form.append('files',fileInputElement.files[0],'file-name.ext');form.append('files',fileInputElement.files[1],'file-2-name.ext');constfiles=awaitstrapi.upload(form);constFormData=require('form-data');constfs=require('fs');constform=newFormData();form.append('files',fs.createReadStream('./file-name.ext'),'file-name.ext');constfiles=awaitstrapi.upload(form,{headers: form.getHeaders()});Custom axios request configuration. See documentation
- GraphQL
- Attach/Detach entry relationship
- Real time with Socket.io
MIT
