Initializing BEE Plugin

We have a shiny, new BEE Plugin technical docs site.
You can find a new version of this page here.

 

Want to get started immediately with some sample code? If so, go here. Otherwise, read on.


To initialize your instance of the editor, call the following endpoint with your Client ID and Client Secret (these are the application keys that you can obtain after signing up at developers.beefree.io).

POST /apiauth HTTP/1.1
Host: auth.getbee.io
Content-Type: application/json 
Accept: application/json 
Content-Type: application/x-www-form-urlencoded

grant_type=password&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET

Below is an example of how to call the BEE Plugin endpoint to obtain a token and use it:

var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (req.readyState === 4 && req.status === 200) {
// Obtain token
var token = req.responseText;
// Call create method and pass token and beeConfig to obtain an instance of
BEE Plugin
BeePlugin.create(token, beeConfig, function(beePluginInstance) {
// Call start method of bee plugin instance
beePluginInstance.start(template); // template is the json to be loaded in BEE
});
}
};
req.open(
'POST', // Method
'/token', // The server side endpoint that calls BEE REST auth endpoint
false // sync request
);

You can consume this endpoint both clientside and serverside. Make sure that this endpoint is consumed over the HTTPS protocol if invoking it from a Web client.

When you do...

  • The system will return a valid token (OAuth2 token)
  • The token will be refreshed automatically by the Plugin (more on this).
  • A configuration document will passed to BEE Plugin to obtain an instance of the editor that matches the configuration (e.g. setting the editor's language to "Spanish").

Next: passing configuration parameters to the plugin.

Have more questions? Submit a request

Comments

  • Avatar
    Rogelio Alejandro Ortiz Sevilla

    For anyone out there using Ruby with the Typhoeus gem:

    Typhoeus.post("https://auth.getbee.io/apiauth",
    body: { client_id: "MyClientId",
    client_secret: "MyClientSecret",
    grant_type: 'password'},
    headers: { 'Content-Type' => 'application/json', 'Accept' => 'application/json' })

  • Avatar
    Martin Bean

    This doesn’t make sense. “/token” is a URI on my server. Shouldn’t this be a full URL on Bee’s server?

  • Avatar
    Samuele Verzi

    @Martin

    Sure, the url need to be the endpoint of the authorization server of the plugin.

    try to see some sample code here:
    http://help.beefree.io/hc/en-us/articles/203135882-Sample-code

  • Avatar
    Berry Tsakala

    How to authenticate my users?
    We'd like to go for the paid plan. We'll have many users.
    We will use bee as a plugin.
    The users should not see each other's resources (images, templates, texts).

    Currently I'm testing on the free plan.
    I couldn't find how to auth my users, or a documentation about it.
    I couldn't find where to add my users,
    and not sure how to authenticate them.

    Where's the documentation for "add users", and "auth my user"?
    Can I try test managing users with the free plan?

    Thanks

  • Avatar
    Guille Padilla

    Hi Berry,
    you don't need to add users or authorize the user in the plugin, you only need to identify each user with a UID in the plugin configuration:
    http://help.beefree.io/hc/en-us/articles/202991212-Configuring-the-editor

    Every UID will access a different set of resources.

  • Avatar
    Carlos Castellanos

    Is there any example for calling "https://auth.getbee.io/apiauth" from node?