Post

0 followers Follow
0
Avatar

Problem integrating BEEPlugin

I'm integrating BEEPlugin.
I'm using php libray for getting the access token and it is working.
Then I'm trying to load the editor like this:

<script src="https://app-rsrc.getbee.io/plugin/BeePlugin.js" type="text/javascript"></script>
<script>
    var beeConfig = {
        uid: 'myuid',
        container: 'beefree_container'
    }
    BeePlugin.create('<?=$access_token;?>', beeConfig, function(beePluginInstance) {beePluginInstance.start();});
</script>

I can see the loading bar load but when completed (after about one second) it writes in the embed "Errors in BEE Plugin configuration."

No js error or console message detected.

How can I understand the problem?
I'm not sure about the config param "uid", how do I have to set it?

Thank you!

admin

Please sign in to leave a comment.

16 comments

0
Avatar

Hi, can you try adding a JSON.parse as in the line bellow?

BeePlugin.create(JSON.Parse('<?=$access_token;?>'), beeConfig

Guillermo Padilla 0 votes
0
Avatar

"JSON.Parse" gives me a "JSON.Parse is not a function"
so I tried with "$.parseJSON" but it sees the token is not json.

I'm not sure about the config param "uid", is it my application name?

admin 0 votes
0
Avatar

Hi Massimo and thank you for the answer.
Yes I read it on the documentation but how can I know which is my uid?

Yes I still have the problem but maybe the wrong uid is the cause.

admin 0 votes
0
Avatar

The UID is just an alphanumeric string that you pass to the plugin. It's not something that we defined. It's something that your application uses to uniquely identify its users.

Massimo Arrigoni 0 votes
0
Avatar

Ok thank you, so the problem is not the wrong uid.
Please, how can I debug an "Errors in BEE Plugin configuration." ?
How can I understand which is the problem?

admin 0 votes
0
Avatar

Please, can you post here a sample value for '<?=$access_token;?>' ?
In this way we can check if the token is correctly managed.
Thanks.

Guillermo Padilla 0 votes
0
Avatar

Thank you Guillermo

here is the access_token:

hAyzH0RGnMSLs88qXxbY-emAjEhK9SkRbxrd2q2dqAzYxHscMchlpitY8eqKOlgTsIVkeohylUt2d2XmTpIBHTIYv61T4qcn2KkDuHhW1LR6-er47uwyb_1UjpmFkt5KocrsyCvy8iusZaShLaBWqVJWv_AFpNZsg8x_602QyYJdBKvUt_zMo9UX-zxgf7Cx8hjanqDrLF_gjlbPER80bts1NXGPDw8ABT2G8p00Tk7UiIZtKXtfTRQXjU8xQY3w-MaJLOGXUG56nVlQj3D7Nb_9ZxNn5ZsOTwqtbNwNq3F3oaUIC55hHBBRFMX3iy9YS4tIMVclFHKUq85eCaYUu0V9hiUMmqPpQWkNBEJdeE3x_TA5Ab8S-PqNCUuAnMbb

admin 0 votes
1
Avatar

The entire token must be passed, not only the access_token.

An example of what the editor awaits as token:

{
"access_token": "4lsXEplsJBd4ooqHqJa98A38A__pOlUFQQDjqlQNwE7REPxhOvbq4CCFYOGdzYCnqAP6TMj40M6aIjYTb3nsMAvqb4yvcbQz9jUl8Cx8B2HYkeJUY-78GIhMnZr2Fxpz_1QUxtIk-hCGaXmsKJuRY_WM_VpNsJmm5ueGzZfEHZuC2UkbK9XuzoQeKe-HEl-URRlPq0eryRsjKv2JOQjSTaKdqsC7a3yJTvL1FHy_Xb64TpK7azJ_h1lxF0DUHwriIa64OIQE7v-2f1sNuiwppSfhDCgFEIfkRUuS4bN8AnuPhsmrAtYlV0CNzuCujHzTjei9B09nE6fVzmUMq2vaHg",
"token_type": "bearer",
"expires_in": 59,
"refresh_token": "6b1dca6d2852421aa5196d84b579bf4a",
"as:client_id": "BeeAppPre",
"userName": "Ql5SO8JHcfjK",
"as:region": "eu-west-1",
".issued": "Mon, 16 Nov 2015 17:16:49 GMT",
".expires": "Mon, 16 Nov 2015 17:17:49 GMT"
}


In case it arrives as a string, must be parsed as a JSON.

Tell me if this helps.

Guillermo Padilla 1 vote
0
Avatar

wow, ok.

then, my php code now is this

<?php
$beefree_obj = new BeeFree("60e97a19-dc33-44a7-a972-48ce213eb8de", "my-client-secret");
$beefree_result = $beefree_obj->getCredentials();
?>
<script src="https://app-rsrc.getbee.io/plugin/BeePlugin.js" type="text/javascript"></script>
<script>
var beeConfig = {
uid: 'my-test-uid',
container: 'beefree_container'
}
BeePlugin.create('<?php echo json_encode($beefree_result);?>', beeConfig, function(beePluginInstance) {beePluginInstance.start();});
</script>

that produce this output:

<script src="https://app-rsrc.getbee.io/plugin/BeePlugin.js" type="text/javascript"></script>
<script>
    var beeConfig = {
        uid: 'my-test-uid',
        container: 'beefree_container'
    }
BeePlugin.create('{"access_token":"jrzwUt42QH2dmxEJR277hekoKcC87Hf-CB2EwE44G9JXb21Ft4BuHlttlq6UKZz8D5e2Mfw2D6K24A78-uFpfAxDQ68mtZDT6FceA1MFcskGXc2n8HB8rNBDxD2xDC4YMciwgKD29-8Czk-HqZWJdDBFQ5s4aIFgxbhNQmXH2VuLeMzl6n2an-L2pddDKNAGRyuXAk30BEvem7KKfOa_hNQzeV_ua-vT-uPCw2K7GK7X3MHranaA4U6PhoWkcCdWEpcGEDUMq15Kg-Q7nxeWxkDgX7l28If1qorGkf6jpsjaaFRYuHtUmUkW_JAPxWXfZ0e1BAx52H7IPFHd5OpiYmf-C0ROQB0Jn_Bj-PzBPbEaUp1Fscmnyqd2Xx3HUNoj","token_type":"bearer","expires_in":59,"refresh_token":"c847299c44634c259d53bbd25222825f","as:client_id":"60e97a19-dc33-44a7-a972-48ce213eb8de","userName":"GWJvEcetwLF3","as:region":"eu-west-1",".issued":"Tue, 17 Nov 2015 13:59:07 GMT",".expires":"Tue, 17 Nov 2015 14:00:07 GMT"}', beeConfig, function(beePluginInstance) {beePluginInstance.start();});
</script>

but it doesn't work yet

admin 0 votes
0
Avatar

It seems that the token is still rendered as a string, and not a JSON object (json_encode returns a JSON encoded string).
Can you please parse the token client side (using JSON.parse or $.parseJSON)?

Guillermo Padilla 0 votes
0
Avatar

Ok great, I removed the single quote so I'm passing the whole json object and we made a big step: now the horizontal bar is gone and I see a circle loader but it stay there turning with no end and I can't see the editor.

Can you help me to debug this now?
Thank you

admin 0 votes
0
Avatar

Thank you Guillermo,
in that info page I can read:
"templateToLoad is the json file to be loaded inside Bee"
What does it means? Do I have to pass to the function the template JSON string? Or the Json Object? Or an url or path pointing to the JSON file?
And which json template can I use for starting?
Thank you very much

admin 0 votes