*That is, in PHP.
Main Topics
Browse All TopicsHi Experts,
I've recently started exploring facebook apps, using it with AS3, I read all over the net that one should be careful with the api keys and the special secret, but I haven't found a good explanation on how to properly secure these data and eventually inject them into your code.
I Need to get these values into the javascript of my html page, how can I do this?
from a database?
through php?
https// ...
I'd like a complete answer for this one, with the necessary links and instructions on how to formulate my code.
Thanks in Advance !
DM
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You can use the JS XMLHttpRequest Object to dynamically load information served by PHP.
I suggest you try to create something using JavaScript and PHP this way, and if you have any questions, post a link to your test page(s) and/or supply code, so we can help you with any additional problems.
Kind regards,
Matthias Vance
References
Hi there Matthias,
I took a look at your suggestion and it's very interesting, I was able to make an HttpRequest from JS to PHP,
trouble is, I'm still a bit in the dark on how to secure the data (api_key and secret) .
If I let the php echo those values, they will still be visible to anyone who wants to look for them, aren't they ?
script I'm using below,
I'm probably doing this the wrong way, your help is highly appreciated !
DM
Well, you sure don't want to GET the data from PHP.
It needs to stay server side.
I don't know the FaceBook API, but let's say you want to add a friend, by using JavaScript and PHP. The API for that might be facebook.com/addFriend.php
Yo
And that PHP page would load the API key from a configuration file, and do the request.
Kind regards,
Matthias Vance
Business Accounts
Answer for Membership
by: MatthiasVancePosted on 2009-10-15 at 05:14:15ID: 25579635
Well, any code you have in JavaScript will be visible to the end-user (and any intermediates).
I suggest that you create a configuration file with all the information, and when you need it in an action (that you call from JS), you just include it.
Kind regards,
Matthias Vance