Daniel_Grosso | 2017-08-07 14:33:03 UTC | #1
Hello everyone.
We are using the Js SDK to reproduce some client functionalities and we realize that it doesn't seem to be possible to obtain the oauth token requested internally by the sdk. According to the code it is persisted on a "localStorage" structure, but it seems private. On the other hand we could use the api implicitly to perform the auth but then it would also not be possible to persist the token in this "localStorage", right? It is important to us to get the token because we need to keep it within the user session of our front-end.
Also (not sure if it maters) we are temporarily using implicit grant method but as soon as our client sets their ADFS we will be using SAML. I think the issue remains in both approaches, right?
Thank u. Regards, Daniel Grosso Lisbon, Portugal
tim.smith | 2017-08-07 14:42:41 UTC | #2
You can retrieve the access token via platformClient.ApiClient.instance.authentications['PureCloud Auth'].accessToken.
Daniel_Grosso, post:1, topic:1652
Also (not sure if it maters) we are temporarily using implicit grant method but as soon as our client sets their ADFS we will be using SAML. I think the issue remains in both approaches, right?
All OAuth flows result in an access token. However, the JavaScript SDK does not contain a helper for SAML auth, so you'll need to build that process out yourself. That will give you the auth token that you'll need to provide to the SDK, which makes retrieving the access token from the SDK moot.
Daniel_Grosso | 2017-08-07 15:14:06 UTC | #3
tim.smith, post:2, topic:1652
platformClient.ApiClient.instance.authentications['PureCloud Auth'].accessToken.
Hello Tim, first of all, we really appreciate the quick assistance (specially yours) on this forum, it's been very helpful.
We understand the absence of an helper for SAML auth but this doesn't mean we can't use the SDK for everything else, right? Would it be enough to set variable above with the previously obtained token?
Best regards, Daniel
tim.smith | 2017-08-07 15:20:37 UTC | #4
Daniel_Grosso, post:3, topic:1652
We understand the absence of an helper for SAML auth but this doesn't mean we can't use the SDK for everything else, right? Would it be enough to set variable above with the previously obtained token?
Take a look at the Authentication section in the JS SDK docs. You can provide your own auth token that you obtained outside of the SDK (e.g. from a SAML flow):
var client = platformClient.ApiClient.instance;
client.setAccessToken(yourAccessToken);
// Do authenticated things; no login function needed
Daniel_Grosso | 2017-08-07 15:33:46 UTC | #5
;) got it
Thank u.
Regards, Daniel
system | 2017-09-07 15:33:51 UTC | #6
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 1652