Get Agent Token

Hello,

I need to know how to get the Token created for each agent is logged.
PureCloud already have some API with this function ?

Regards,

Edson Ogushi

Hi there Edson. Welcome to the forum! The Audits API will provide logging for token creation. Here's some documentation to get you started: https://developer.mypurecloud.com/api/rest/v2/audit/actioncatalog.html

Hello Becky,

I saw the audit API and I made some tests, but the information that the API returned to me it not what I looking for, I will try to explain why I need the Agent Token info in my system.

Basically we want to our system make the dial call for the agent. So in the code bellow you can see the Token (variable "accessToken"), that I'm using to make the call.
The system works when a I have the agent token information, but I need to get the agent token automacally to set in my system.

  ConversationsApi conversationsApi = new ConversationsApi();
            CreateCallRequest createCallRequest = new CreateCallRequest();

            conversationsApi.Configuration.AccessToken =  accessToken;

            createCallRequest.PhoneNumber = "7852";
            conversationsApi.PostConversationsCalls(createCallRequest);

Thank You !!

Regards,

Edson Ogushi

Hello,

You can make a call, as long as it is done in the context of a user.
It means you need to get your access token with:
Implicit Grant or with Authorization Code Grant.

The Implicit Grant is a single-step authentication process where a user authenticates with PureCloud and the client application is directly returned an access token. This option provides less security for the access token than the authorization code grant, but is ideal for client-side browser applications (i.e. JavaScript) and most desktop applications (e.g. .NET WPF/WinForms or Java desktop programs).
See here for more details: https://developer.mypurecloud.com/api/rest/authorization/use-implicit-grant.html

The Authorization Code Grant is a two-step authentication process where a user authenticates with PureCloud, then the client application is returned an authorization code. The client application uses the authorization code to make an unauthenticated API request to get an access token. The access token can then be used when making authenticated API calls. This is the most secure option and ideal for websites where API requests will be made server-side (e.g. ASP.NET or PHP) and some desktop applications where a thin client would authorize the user and pass the auth code to a back-end server to exchange for an auth token and make API requests.
See here for more details: https://developer.mypurecloud.com/api/rest/authorization/use-authorization-code.html

The access token obtained via Client Credentials Grant WILL NOT allow you to make calls.
See here for more details on what client credentials is: https://developer.mypurecloud.com/api/rest/authorization/use-client-credentials.html

See here for tutorials - there are some showing how to get the access token in the different models.
https://developer.mypurecloud.com/api/tutorials/index.html

Hello Jerome,

Thank you for your help.

Regards,

Edson Ogushi

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