OpenID and Google.GData.AccessControl.dll in C#

2020-04-30 18:02发布

问题:

I am designing a web site to use OpenId and Google is one of the main providers I have selected. What I would like to do is use Google's Calendar & Contacts (possibly docs) as a backing store for each individual user. In other words, if the user on my site wants to have access to a Contacts List, Calendar, etc they must register their Google account. Then they can add/edit/delete to their heart's content as it is their info. (And yes, I have a specific idea in mind for where I am going, just need to figure out how to tie OpenID to GData.)

Has anyone written a tie in between OpenID/OAuth and using the Google APIs?

回答1:

After a lot of digging in to this problem I have 2 ways of solving this.

  1. Use OpenID and on the user's profile, have them enter their google credentials (works but not a great solution)
  2. Use OAuth. This requires registering your domain with google and getting a key to use with OAuth. Once you set that up it is easy to access a end user's data stores on google.

Look at google's OAuth 1.0 for Web Applications.

Also look at OAuth-OpenID: You’re Barking Up the Wrong Tree if you Think They’re the Same Thing for a good overview of OpenID vs OAuth.



回答2:

Have you looked at DotNetOpenAuth? It will allow you to connect to any open authentication provider that supports OpenID and Google is one of the providers listed on the OpenID page.

Has anyone written a tie in between OpenID/OAuth and using the Google APIs?

I'm not sure what you mean by that... if you're asking if there is a library that allows you to user your google account as an OpenID, then yes: DotNetOpenAuth. There are some catches tho, see Andrew Arnott's answer to this question.