[Solved] JSConnect: Must Be Missing Something
Hi all,
We're trying to get the JSConnect plugin working but aren't having any luck. The plugin is installed correctly & the remote authentication URL looks good. When we hit the "test" button we go to the page on our system containing the following text:
test({"uniqueid": "1O1Yh20j2dw","name": "Lee Theobald","email": "lee@ltheobald.co.uk","client_id": "953808662"});
Some quick questions on this:
- Does the callback function name matter? In the documentation it's listed as "callback" but in this forum you see "test" used a lot. The "Test URL" button also calls our URL with a parameter or "callback=test" appended to the end. Trying both test & callback as function names doesn't make it work either way.
- Is the signature parameter required? The example JSONP fragments in the technical documentation say it's required but then directly underneath it says:
The signature is used to secure the response and is very important, but can be left out if you are just testing
With or without the signature, we still can't get a login performed.
- Does the URL extension matter? Our page ends in a custom extension (.page) but is returning the content with a mime type of application/json
Now what's happens when we go to our forum is very little. The sign in buttons & register buttons are shown, we sign in but when we go back to the forum, the buttons are displayed again - we are never signed in. There's a quick "flash" where the buttons are added via JavaScript so am I right in thinking it's checking our login at this point?
Cheers for any help,
Lee
Comments
Right, we got there in the end. For us, the issue was the function name: test, callback etc. The JSConnect will call your authentication page with a request parameter called "callback". The value in this is what you need to use in creating your JSONP portion. So for example, the test URL link contained
callback=test
so our function needed to take the form oftest({...});
. If the request parameter was callback=foobar, then you'd have to usefoobar({...})
. I obviously skipped over this part in the docs.@Leesy
Thanks for posting back your solution.
UP, i have the same problem.
I don't undersand what type of code Json is required to "log" or "create" user.
May be can you give me just a sample example of json ?