Fauerbach_Frank | 2016-07-29 12:49:15 UTC | #1
Hi, all,
I try to create a PureCloud Session to Ireland environment. As written in the docs it should work like this:
<script src='https://code.jquery.com/jquery-1.11.3.min.js'></script> <script src="https://sdk-cdn.mypurecloud.com/javascript/0.51.1/purecloud-api.min.js"></script> <title>PureCloud API</title>
<script type="text/javascript"> var pureCloudSession = purecloud.platform.PureCloudSession({ strategy: 'implicit', clientId: '7e2f3de6-e99e-4fbb-af90-e1227dd0aa34', redirectUrl: window.location.href, environment: 'mypurecloud.ie' });
But it won't. Running that page still point me to mypurecloud.com where the ID does not exist.
Many thanks Frank
KevinGlinski | 2016-07-29 13:42:44 UTC | #2
I'm not sure, this code works for me and redirects me to login.mypurecloud.ie. You may have to debug the session object.
<html> <head> <script src='https://code.jquery.com/jquery-1.11.3.min.js'></script> <script src="https://sdk-cdn.mypurecloud.com/javascript/0.51.1/purecloud-api.min.js"></script> <title>PureCloud API</title>
<script type="text/javascript"> var pureCloudSession = purecloud.platform.PureCloudSession({ strategy: 'implicit', clientId: '7e2f3de6-e99e-4fbb-af90-e1227dd0aa34', redirectUrl: window.location.href, environment: 'mypurecloud.ie' });
pureCloudSession.login() .then(function(){ var users = new purecloud.platform.UsersApi(session); users.getMe() .then(function(user) { // successfully got the user object, do something with it here }) .catch(function(error) { // an error occurred getting the user object }) .finally(function() { // this will be called for successes and failures }); }); </script> </head> <body>
</body> </html>
Fauerbach_Frank | 2016-08-02 14:11:55 UTC | #3
Damn. Stop NodeJS and start it again solved that. That wasn't expected. Thanks for your help Aplogize for that post
Frank
system | 2017-08-28 19:25:42 UTC | #4
This post was migrated from the old Developer Forum.
ref: 191