2
我試圖在用戶使用Google帳戶登錄到我的MVC5網站時獲取用戶的出生日期和頭像/圖標/照片/圖片。使用MVC5 GoogleAuthenticationOptions在身份驗證期間獲取額外的用戶配置文件信息
我讀過這樣的:
Get ExtraData from MVC5 framework OAuth/OWin identity provider with external auth provider
但它並沒有多大意義......我,我想知道這一點?
在我Startup.Auth.cs文件我有這樣的片段:
var gProvider = new GoogleAuthenticationProvider { OnAuthenticated = context => { var claims = context.Identity.Claims.ToList(); return Task.FromResult(0); } };
var gOptions = new GoogleAuthenticationOptions { Provider = gProvider };
app.UseGoogleAuthentication(gOptions);
索賠變量包含5個項目:(每個項目以 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/')
0: { nameidentifier: https://www.google.com/accounts/.../id?id... }
1: { givenname: Benjamin }
2: { surname: Day }
3: { name: Benjamin Day }
4: { emailaddress: [email protected] }
誰能幫助指出我做錯了什麼,或者我錯過了什麼來獲取我正在尋找的額外配置文件數據?