2015-10-04 141 views
2

我目前正在設置一個外部登錄(谷歌)到我的AngularJS WebApp,這是與Web API交談,所有本地,但我有問題。AngularJS + WebAPI外部谷歌身份驗證

我已經按照http://www.asp.net/web-api/overview/security/external-authentication-services中關於如何設置谷歌身份驗證的步驟,其中涉及到只需添加app.UseGoogleAuthentication();沒有appId或clientSecret像其他提供商如Facebook一樣。

現在要我的API我查詢,並得到所有供應商使用以下GET /api/Account/ExternalLogins?returnUrl=%2F&generateState=true,這回[{"Name":"Google","Url":"/api/Account/ExternalLogin?provider=Google&response_type=token&client_id=self&redirect_uri=http%3A%2F%2Flocalhost%3A11942%2F&state=E2eXxoZ02yUg39-DrwZTXHnrV5FrOhUe-k-zz-oD6uE1","State":"E2eXxoZ02yUg39-DrwZTXHnrV5FrOhUe-k-zz-oD6uE1"}]

,並從互聯網閱讀我扯下了URL /api/Account/ExternalLogin?provider=Google&response_type=token&client_id=self&redirect_uri=http%3A%2F%2Flocalhost%3A11942%2F&state=E2eXxoZ02yUg39-DrwZTXHnrV5FrOhUe-k-zz-oD6uE1並加入到一個錨標記,所以我想這個應該有重定向我到google認證,但是我收到一個錯誤信息

enter image description here

有誰知道爲什麼嗎?另外,當將鏈接添加到錨標籤時,我會在開始時爲我的API http://localhost:11942/添加鏈接。

謝謝

回答

0
+0

謝謝你。現在我有一個不同的問題。在用戶通過身份驗證後,它將它們引導到API,並且我不希望發生這種情況,於是我想在這種情況下返回到我的應用程序http:// localhost:8000。你知道該怎麼辦? – Jordan

+0

提供登錄操作的示例代碼 – melsaqqa