Hi all,

I had the problem described in the title (duplicated entry 0 for csid) creating a consumer and writing to the database. Debugging a little bit I found that the problem happens writing in the oauth_common_provider_consumer table. If I understand it right, in the write method of the class DrupalOAuthConsumer, it firsts create the oauth_common_provider_consumer without a csid value, then it creates the oauth_common_consumer and with the Primary Key it updates the csid value in the oauth_common_provider_consumer entry. Because csid is marked as unique, if there is an error between the first step and the second step, we will have an entry with csid 0 so the next time we will get this error.

I think that It can be fixed if we always write to oauth_common_provider_consumer after writing to oauth_common_consumer, but I'm not sure if I'm missing something.

Thank you.