You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

OAuth - Service cloud stucked while acquiring token using .net addins

Received Response
6
Views
3
Comments
edited Jun 8, 2022 11:58AM in General Technical Discussions 3 comments

Content

Hi

On button click I need to Acquire Access token and using that token. Have to make Rest APi calls.

While acquiring the token itself the service cloud stucked and unable to perform any operation. I

Attached code please provide me a solution.

ThanksInAdvance.

Code Snippet

             private void button1_Click(object sender, EventArgs e)
        {
            authContext = new AuthenticationContext(authority);
            clientCredential = new ClientCredential(clientId, appKey);

            PostTodo().Wait();
        }

        static async Task PostTodo()
        {
            AuthenticationResult result = null;
            try
            {
                result = await authContext.AcquireTokenAsync(ResourceID, clientCredential);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
} 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!