Social Networking: Twitter API (authentication error)

Sep 3, 2010 at 4:25 PM

Hello Community,

Recently I have been playing with the Social Networking accelerator. I checked several forums and found different "bugs" to be fixed for the date conversion and the missing fields on a entity. All that is done.

However, I am still struggling with the two update workflows that are supposed to connect to Twitter and exchange information. I have checked the trace logs and it seems like there is an authentication error with the Twitter server:

[2010-09-01 08:43:51.0] Process:CrmAsyncService |Organization:caecc417-507b-4c53-bfb7-cd67fd41fba7 |Thread:    3 |Category: Platform.Workflow |User: 00000000-0000-0000-0000-000000000000 |Level: Error | WorkflowHost.OnWorkflowTerminated
 at WorkflowHost.OnWorkflowTerminated(Object sender, WorkflowTerminatedEventArgs args)
 at WorkflowRuntime.OnScheduleTerminated(WorkflowExecutor schedule, WorkflowTerminatedEventArgs args)
 at WorkflowRuntime.WorkflowExecutionEvent(Object sender, WorkflowExecutionEventArgs e)
 at EventHandler`1.Invoke(Object sender, TEventArgs e)
 at WorkflowExecutor.FireWorkflowTerminated(Exception exception)
 at SchedulerLockGuard.FireEvents(List`1 eventList, WorkflowExecutor workflowExec)
 at SchedulerLockGuard.Dispose()
 at WorkflowExecutor.RunSome(Object ignored)
 at WorkItem.Invoke(WorkflowSchedulerService service)
 at DefaultWorkflowSchedulerService.QueueWorkerProcess(Object state)
 at _ThreadPoolWaitCallback.WaitCallback_Context(Object state)
 at ExecutionContext.runTryCode(Object userData)
 at RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
 at ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
 at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
 at _ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
 at _ThreadPoolWaitCallback.PerformWaitCallback(Object state)
>Workflow terminated: {B02E2DAB-DFB5-DF11-A9F8-0003FFBEFD44} - System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   at MSA.SocialNetworking.msa_twitter.SendRequest(Uri _URL, CredentialCache _creds, String _type, String _message)
   at MSA.SocialNetworking.msa_twitter.SendRequest(Uri _URL, CredentialCache _creds, String _type)
   at MSA.SocialNetworking.msa_twitter.GetUpdates(String _id)
   at MSA.SocialNetworking.GetUpdates.Execute(ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext)
   at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime)
   at System.Workflow.Runtime.Scheduler.Run()

I have made sure that the credentials are right, but it stills seems like Twitter is not authenticating my user.

Now, I have also come accross this piece of news that states that the Twitter Authentication API was shut down. Could it be because of that? http://dev.twitter.com/pages/basic_auth_shutdown

Has anyone else encountered this error? I am grateful for any clues.

Best regards,
Manuel

Sep 14, 2010 at 3:11 AM

It looks like Twitter now requires OAuth authentication. This means that the Social Networking accelerator will no longer work until someone does a fairly significant refactoring of the code. Twitter has loads of resources to help with the task, but I must admit I am at a loss for where to start.

Sep 14, 2010 at 1:38 PM

NameOfTheDragon,

Okay, thanks for the confirmation. I wasn't sure, but I guess it's true then, the SNA doesn't work no more with the new authentication.

I am amazed that no one has brought up the subject yet. I mean, correct me if I'm wrong, but basically this means that no one ought to be able to use the SNA ever since they changed the authorization, right? So how come no one is making some noise? I tought this was one of the big buzzy accelerators.

I will talk to our dev guys. See if they can take a look at it.

Thanks again,
Manuel

Oct 9, 2010 at 2:21 PM

Hi Guys,

I prepared a patch to use the accelerator with the new twitter authentication method.

Is there anyone that can help me with the beta test?

thank you

Roberto

 

Oct 9, 2010 at 2:38 PM

rnocera, count me in.

Oct 19, 2010 at 10:32 AM

Rnocera,

what is progres on testing?

 

Oct 19, 2010 at 10:59 AM

Sorry, testing what? The last I heard was that you were looking for beta testers, then nothing. Did I miss some email?

Best regards,

Description: Description: Description: Tiger Relief.png

Tim Long

Principal Technology Specialist

TiGra Networks

The Small Business IT Specialists

0845 8620518 | www.tigranetworks.co.uk

Join us on LinkedIn | Twitter | Facebook | Email policy

From: dejanzivanovic [mailto:notifications@codeplex.com]
Sent: 19 October 2010 11:33
To: Tim Long
Subject: Re: Social Networking: Twitter API (authentication error) [crmaccelerators:225978]

From: dejanzivanovic

Rnocera,

what is progres on testing?

Read the full discussion online.

To add a post to this discussion, reply to this email (crmaccelerators@discussions.codeplex.com)

To start a new discussion for this project, email crmaccelerators@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Oct 19, 2010 at 11:04 AM

sorry guys, to generate confusion.

the code is ready to be tested and I'm working on a short document on how to install the patch.

I create a temp project on codeplex to release the patch. just few updates and tonight I will share with you 

Sorry again for the delay in my communications.

 

thank you

Roberto

 

Oct 19, 2010 at 11:08 AM

Ah, sounds good. I look forward to trying it.

--Tim

From: rnocera [mailto:notifications@codeplex.com]
Sent: 19 October 2010 12:05
To: Tim Long
Subject: Re: Social Networking: Twitter API (authentication error) [crmaccelerators:225978]

From: rnocera

sorry guys, to generate confusion.

the code is ready to be tested and I'm working on a short document on how to install the patch.

I create a temp project on codeplex to release the patch. just few updates and tonight I will share with you

Sorry again for the delay in my communications.

thank you

Roberto

Read the full discussion online.

To add a post to this discussion, reply to this email (crmaccelerators@discussions.codeplex.com)

To start a new discussion for this project, email crmaccelerators@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Oct 19, 2010 at 11:37 AM

I will test it on CRM Internet Facing Deployment

I hope that it will work!

 

Oct 20, 2010 at 2:50 AM

Dear all,

I just published a temporary codeplex project for the Social Networking Patch.

Actually it's a beta. I didn't test in all scenarios (IFD for example) and then your help to verify the solution is very appreciated.

I had problems to connect with my Visual Studio 2008, anyway at this link http://msdyncrmsn.codeplex.com/ you can find the output and the documentation to install it.

 

If you have any question do not hesitate to contact me.

Thank you again for your support.

if you want receive update on progress about this project, please follow me on twitter http://twitter.com/noce2k

Roberto

 

 

Oct 27, 2010 at 1:19 PM

HI,

I am having some trouble with deployment of your solution. I have followed the instructions and at the end there is no Twitter Authorization section added to a Social Network User form. I have imported and published customizations correctly. Am I doing something wrong?

Thanks in advance

Oct 27, 2010 at 6:29 PM

rnocera, thanks for publishing your patch. I am up to my eyeballs with an office move this week and I also have a problem with my CRM system that is preventing me from publishing customisations. I will do my best to install your patch next week. I've been maintaining a VS2010 solution with some other fixes and updates, if you like, I could integrate your patch into that solution.

--Tim

Nov 19, 2010 at 4:02 PM

I too could not find the IFRAME with the Twitter Authorization section. It was not included in the CRM Customization.xml file. I also had issues uploading the msa_SNStatus entity. I had to create the new fields included in the XML manually. I finally got it to work by adding the IFrame manually, using the follwoing URL: http://Server:Portnumber/ISV/twitterAuthorization/RetrieveToken.aspx

I also had to add the following missing Attribute: new_twitteroauthtoken (NVarChar, 200 Length), then I had to add it to the CRM SNUser form.

 *NOTE* this uses the "new_" prefix, if your system is set to a different prefix, you'll need to update it to "new_" is System Settings before cerating the Attribute, then set it back once you've published your changes.

Then .aspx page also left the IFrame and opened in a new IE window, so I had to copy/paste most of the tokens fields into CRM manually.

You will then need to go into each workflow that uses the TwitterOAuthToken as a Dynamic Value (though I found several workflows and Update Steps therein that published sucessfully, but were missing other Dynamic Values, best to check *everything*

I think that's it. I'm ready to test now and will let this forum know how it goes...

Nov 19, 2010 at 5:01 PM

So I tested with my own personal account with complete success! Thanks to Roberto for posting this fix! I can finally go to my clients with the good news!

Jan 12, 2011 at 8:09 AM

I did everything you described guys, but was getting serious problems. It gave me several Unauthorized errors. First thought that this was because I did something terribly wrong, but found out that in fact twitter changed their api. It no longer works with http://twitter.com but with http://api.twitter.com/1. After changing this in the plugin code, I kept on getting 'authorization' problems with the replies method. It seems that the method no longer exists. Therefore, I changed it to the mentions method. You could also implement the timeline or retweets method. If any of you want the new plugin code, please let me know on twitter or leave a reply here.

Jan 17, 2011 at 3:44 PM
"Then .aspx page also left the IFrame and opened in a new IE window, so I had to copy/paste most of the tokens fields into CRM manually."
@mdodd on Nov 19 2010 at 6:02 PM
 
 <abbr>Just disable the 'Restrict cross-frame scripting' of your IFRAME....</abbr>