c# - FetchData using DotNetOpenAuth? -
i have implemented this simple code described here ( vs 2010 , webforms)
protected void page_load(object sender, eventargs e) { var openid = new openidrelyingparty(); var response = openid.getresponse(); if (response != null && response.status == authenticationstatus.authenticated) { formsauthentication.redirectfromloginpage(response.claimedidentifier, false); } }
click
function :
protected void btngoogle_click(object sender, imageclickeventargs e) { using (openidrelyingparty openid = new openidrelyingparty()) { var request = openid.createrequest("https://www.google.com/accounts/o8/id"); request.redirecttoprovider(); } }
question #1
when click login ( via google) opens this consent screen :
but how come works ? thought have create api key in google developer console in order allow people login. ( like did here other app of myne->)
obviously didn't create any "localhost
" app. how still works ? (again it's demo i've downloaded internet).
question #2
once have a result :
how can fetch user data ? ( email example) {the article doesn't mention it}
nb dotnetopenauth ver 3.4.6.10357
that line works because uses openid , not oauth2. open id old school before oauth2.
you should aware of:
important: google has deprecated openid 2.0 , shut down after migration period. if app uses openid 2.0, userinfo endpoint, or oauth 2.0 login (early version), should migrate app deadlines given in migration timetable.
because openid has been depreciated , shutdown before april 20, 2015 wouldn't recommend developing it.
to answer question request doesn't require client id because opened , not oauth2 oauth2 requires client id.
recommend: google apis client library tutorial: google oauth2 c#
Comments
Post a Comment