Usage of client.loginClientCredentialsGrant() function

Hi Team,
I am trying to get the real time notification on an angular UI project. I am following the steps mentioned in the post : https://developer.genesys.cloud/notificationsalerts/notifications/subscribe-to-queue

I am getting a console error while accessing the loginClientCredentialsGrant() says "Buffer is not defined" and the code stops there.

Am I missing something on here ?

Can I use the npm package "purecloud-platform-client-v2" to angular project and login the client with CLIENT ID and Secret, create channel and subscribe to the queue (v2.users.${queueId}.conversations) and listen for notification ?

Hello,

The loginClientCredentialsGrant (that uses an OAuth Client ID and Client Secret to get a bearer token) is not meant to be available for Web based apps.
loginClientCredentialsGrant() will only work in a nodejs app.

As you are planning to expose a UI to a user, you need to leverage a different OAuth Grant flow - with user context - as an example, the loginImplicitGrant (about Implicit Grant).

You can find a sample Angular project in our available blueprints. I don't know if all dependencies are up to date, but it shows the use of the Platform API SDK and loginImplicitGrant.
See Develop an Angular app that uses the Genesys Cloud Platform SDK

Regards,

Thanks @Jerome.Saint-Marc for your reply to my query.

I have a UI project and a back end api. So i am able to use the SetAccessToken method in UI. Mine is an angular 11 project.
The SDK "purecloud-platform-client-v2" is working fine in angular 17 project with out any issues, But when I refer the PlatformClient in any version lower than angular 17, I am getting a message below.


Could you please guide me if you know any work around for this issue ?

I don't have much knowledge on Angular so I can't guide you on this.
But I'd recommend to check the project (blueprint) I mentioned in my previous post. This is the Github repo of the project.
It was using Angular 12 apparently - so maybe close enough to your Angular 11.
You can have a look at the angular.json to see how the Platform API SDK is referenced.

There was also this other post on Angular 12 project that may be of interest: How to Add PureCloud SDK to Angular (12)

Regards,

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.