문제

I am trying to develop a web server application, running on an in-house server using C# and .net. The purpose of my application is to interface with Google Calendar, read events and then generate travel expense reports.

Basing my OAuth2 piece of the code from the example here I was able to come up with an application that works, mostly.

I say mostly because somewhere along the lines, confusion arises as to whether a user is logged in and or authenticated and which user is logged in.

For example: If I launch Chrome and then access my application, all is well but if I then open another Browser (IE or FF), log in to a different Google account and then launch my application, the report it gives is that for the account that was/is logged into Google in Chrome? In the first browser (Chrome in this case) the URL contains the parameter ?code but the URL in the second browse does not and remains simply the URL to my application.

When I launch my application in the 2nd browser using a different Google account, it appears that Authentication is failing (Button text remains "Authenticate" BUT the line of code, see below, that fetches the calendar list is still executing and receiving a response after clicking on the "Authenticate" button, with the returned data being from the account that is/was logged in via the 1st browser.

CalendarList response = _service.CalendarList.List().Fetch();

I've tried without much success to find out why this is happening but it is starting to drive me crazy and so far limits the usefulness of my application.

Could the problem have something to do with the Session State information that is stored on our server? Is the OAuth2 code sample I am using out of date and if so where would I find a correct example?

Any suggestions would be appreciated.

Thanks

도움이 되었습니까?

해결책

I agree with user2367592, try test your application without a static service, and please let us know if it works.

Anyway, in version 1.5 (currently we use 1.3) we are going to get rid of DotNetOpenAuth and improve the whole OAuth2 experience, so - sorry for any inconvenient.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top