Hey Guys, I am trying to integrate gooddata-ui das...
# gooddata-ui
v
Hey Guys, I am trying to integrate gooddata-ui dashboard component in a html. Trying to use the following code but unable to move forward.
Copy code
<script type="text/javascript" src="gooddata.js"></script>
<script type="text/javascript">
    var sdk = gooddata.factory({ domain: '<http://secure.gooddata.com|secure.gooddata.com>' });
    sdk.user.login('<mailto:john.doe@example.com|john.doe@example.com>', 'your-secret-password')
</script>
https://domain.on.gooddata.com/gdc/account/profile/current 401 (Unauthorized) Unable to login despite correct login details
b
Hi Vatsal, I think you need to use your gooddata domain (URL of your GD environment) instead of secure.gooddata.com (which is historically our default domain).
v
yea I have used custom domain only **.on.gooddata.com only I edited it for obvious reason
b
I can see in our logs some login attempts on secure.gooddata.com with your account at around 8:30 AM CET yesterday (1st of September) - does it correspond with your attempts?
v
Yes correct
b
yes, so the issue is that the login api being called on the wrong domain. Do you use following line?
Copy code
var sdk = gooddata.factory({ domain: '<http://factoreal.on.gooddata.com|factoreal.on.gooddata.com>' });
v
Below is the code I have used and tried to implement <iframe src="https://factoreal.on.gooddata.com/dashboards/embedded/#/project/h3yf5zv9803y576s7r6rvmzm02bd8foq/dashboard/aaD9G8VAf9tl?showNavigation=true" width="100%" frameborder="0" ></iframe> <script type="text/javascript" src="./gooddata.js"></script> <script type="text/javascript"> var sdk = gooddata.factory({ domain: "factoreal.on.gooddata.com" }); sdk.user.login("***********", "************"); </script>
hi @Boris Any update or fix i should try?
b
Hi Vatsal, Like this, the login should work
Copy code
<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body>
		<script type="text/javascript" src="<https://unpkg.com/@gooddata/gooddata-js@13.5.0/dist/gooddata.js>"></script>
<script>
		var sdk = gooddata.factory({ domain: "<http://factoreal.on.gooddata.com|factoreal.on.gooddata.com>" });
		sdk.user.login("abc@abc.abc", "<http://ced.com|ced.com>");
</script>
		
	</body>
</html>
(the library is loaded from web, but ./gooddata.js should work also if you have it locally) the script that reads library is ran first and then you can call the functions from the library… if it’s correct, you should encounter CORS error
v
Yes i encountered the CORS error How can i fix it?
m
It is necessary to set allow origin for your domain.
Support can do it for you, but for development on local it would be better to workaround it. Let me check how to do it.
For production, sure the CORS has to be setup.
v
Thanks
m
Feel free to let us know in case of further questions.