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 ?
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
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.
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.