Bing maps: Specified credentials invalid - bing

I can't seem to get Bing to accept my API key from my dev server-- I've set up an API key from the bingmapsportal.com site, and set the URL to http://localhost and generated the key successfully.
I then implement the map as shown in the API docs, as follows:
<html>
<head>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
function getMap(){
var mapInitOpts = {
credentials: 'mycredentials',
mapTypeId: Microsoft.Maps.MapTypeId.road
};
var map = new Microsoft.Maps.Map(document.getElementById("map_canvas"), mapInitOpts);
}
</script>
</head>
<body onload="getMap();">
<div id='map_canvas' style="position:absolute; top:0px; left:0px; width:100%; height:100%;"></div><br />
</body>
</html>
// map shows invalid credentials error
However, I always get the "Specified credentials invalid" message.
Any ideas on this issue?

Assuming you had 'mycredentials' act as a place holder for your actual credentials for this question posting, try using the API key from the interactive SDK:
AjtUzWJBHlI3Ma_Ke6Qv2fGRXEs0ua5hUQi54ECwfXTiWsitll4AkETZDihjcfeI
If the above works, and the key you obtained doesn't, then something is wrong with your key and you need to work with Bing Dev Support.
If the above key doesn't work, then there is something wrong with your development environment...

Related

Tableau Web Data Connector hosted in a Cloud Platform getting stuck in infinite loop

I have this TWDC(tableau web data connector) app hosted on our company's private cloud.
Every app that are deployed there are accessed after the user logs in via a Single Sign On login page, then redirected to the app.
When I try to use my web data connector on my Tableau Desktop it gets stuck on an infinite loop, after i push the button which does tableau.submit().
I've set the debugger and found out, that when I push the button, the page that is loaded is not the index.html of my WDC but the redirect page from the SSO login.
I have no idea why is this happening, doesn't make much sense, because it loaded the index.html in the first place, but after i push this button it gets back to somewhere in the middle of SSO login and redirect page.
Just a note: It works fine on the simulator.
Any thougths on this?
Here's my code:
HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>TableauAngular</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/tableauwdc-2.3.latest.js"></script>
<script type="text/javascript" src="controller.js"></script>
</head>
<body>
<button id="submitButton">Send</button>
<br />
<br />
<textarea id="log" style="border: 1px solid #000; width: 100%; height: 700px;"></textarea>
<br />
<div id="placeholder"></div>
</body>
</html>
JavaScript
$(document).ready(function() {
try {
$("#submitButton").click(function() { tableau.submit() });
var myConnector = tableau.makeConnector();
// these are function which are not important for this question;
myConnector.getSchema = fnGetSchema;
myConnector.getData = fnGetData;
tableau.registerConnector(myConnector);
} catch (e) {
logger("ERROR: " + JSON.stringify(e));
}
});
This isn't a problem with your code. With the WDC there is an interactive phase where the user is shown a screen and can interact (this is your first SSO sign-in) but then there is a non-interactive (Get Data) phase where Tableau will try to retrieve the data and never shows the SSO login to the user. See docs. Given this page is loaded without user interaction it can't/shouldn't have SSO security on it.

creating html to call Bing Maps

I inherited some code that worked with Bing Maps v6 so I'm now trying to reproduce functionality in v8. I did the following as an initial attempt, but even this doesn't seem to work. (I've tried to follow https://social.technet.microsoft.com/wiki/contents/articles/34568.bing-maps-v6-3-to-v8-migration-guide.aspx along with various other bits I've found online, but I'm coming into this with no knowledge at all of Bing maps, so I've erred in apparently significant ways since this gets no results. Happy for all guidance.
I've omitted our Bing key below, but other than that, this is the code I attempted to use.
<!DOCTYPE html>
<html>
<head>
<title>Title here</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
</head>
<body>
<div id='myMap' style='width: 100vw; height: 100vh;'></div>
<script type='text/javascript'>
var map;
function loadMap() {
map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
credentials: 'BingKeyOmittedHereForSecurityPurposes'
});
map.Geocode('Jericho, VT', GeocodeCallback);
}
function GeocodeCallback(layer, results, places, hasMore, veErrorMessage) {
// no idea what should be here
}
</script>
<script type='text/javascript'
src='https://www.bing.com/api/maps/mapcontrol?callback=loadMap' async defer></script>
</body>
</html>
I'll be adding Pins and possible directions once I get this working, but figured I should get the basics working before getting fancy.
The map doesn't have a geocode function, instead you have to use the search module. Bing Maps V7 and above break out additional functionalities using modules. This makes for a much lighter page load compared to V6 which had every possible feature crammed into a single downloaded file.
In any case here is a sample of how to geocode in V8. https://github.com/Microsoft/BingMapsV8CodeSamples/blob/master/Samples/Search/Geocode.html
Here are some resources to help you with your migration:
Bing Maps V8 code samples
Bing Maps V6.3 to V8 Migration Guide

How to Get Sessionkey by using Facebook javascript API

I am Using the following code to use Fconnect in my website:
<script type="text/javascript" src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" ></script>
<div id="fb-root"></div>
<script type="text/javascript" language="javascript">
FB_RequireFeatures(["XFBML"], function () {
FB.init(MY_App_ID, Domain_Path + "xd_receiver.htm");
});
</script>
<fb:login-button length='short' size='medium' onlogin="facebook_onlogin_ready()" ></fb:login-button>
previously the following code was returning the Session Key but now its not.
FB.Facebook.apiClient.get_session()
its giving Undefined error
How i can get User SessionKey using the Facebook Jascript Api.
That code is using a deprecated API which is no longer supported and could be removed at any time as it's scheduled for deletion.
The current Javascript SDK uses OAuth access tokens, not session keys.

registration-url parameter fails for fb:login-button if oauth 2.0 is enabled

I'm trying to get the registration flow for Facebook login working. Here's a bare-bones example:
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>My Facebook Login Page</title>
</head>
<body>
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<div id="fb-root"></div>
<script type="text/javascript">
FB.init({
appId:'xxxxxxxxxxx',
cookie:true,
status:true,
xfbml:true,
channelUrl : 'http://<myWebSite>/channel.html',
oauth:true
});
</script>
<fb:login-button registration-url="http://<myWebSite>/register"/>
</body>
</html>
(The only things I've replaced above are the website and the appID)
If I try it like this, the login button shows up, but clicking it causes FireBug to report 'Unknown status: undefined' in the browser log. If I remove the 'oauth=true' line though, it works. I'm trying to adhere to the new oauth 2.0 standard, so I'd like to leave it in. Has anyone else run into this? Seems like if this was a bug, it would have been caught pretty early on.
the 'registration-url' parameter is no longer supported by , take a look in the documentation of it. http://developers.facebook.com/docs/reference/plugins/login/
Just check if the user is logged in via the JS-SDK

Specifying parameter in PUT - Rest Web Service

I'm building a REST web service using the Jersey API and I've having a problem passing the parameter to the PUT method. The method is this:
#PUT
#Consumes("text/html")
public void putHtml (String content) {
System.out.println("Content"+content);
}
I'm calling it using the following:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function passName()
{
xmlHttp=new XMLHttpRequest();
var url = "/RestWebApp/resources/greeting";
xmlHttp.open("PUT",url,false);
xmlHttp.send();
}
</script>
<title>REST Testing</title>
</head>
<body>
Put name:<input type="text" name="name"/>
<br />
<input type="button" value="Put" onclick="passName()"/>
</body>
</html>
The PUT method is being called since I'm getting "Content " printed in the server console (which is Glassfish) but the parameter is not being read it seems. Is there an #statement or something which I should add to the parameter?
Thanks!
Krt_Malta
You are not setting the body of the request in your client code.
You need to send some content, e.g.
xmlHttp.Send("here is my content")
However you have declared your receiving endpoint to accept "text/html". I would change that to accept "text/plain" instead. Or if you really want to receive multiple values you could accept "application/x-www-urlencoded-form". However you will need to format that yourself in the javascript. Web browsers don't know how to PUT forms. They can only POST forms.