簡體   English   中英

ASP.NET MobileServiceClient上的Azure移動服務Google身份驗證錯誤

[英]Azure Mobile Services on ASP.NET MobileServiceClient Google Authentication Error

我遇到一個奇怪的錯誤。 通過社交提供程序進行身份驗證時,應該是MobileServiceClient錯誤。 我和Google都有這個特別的問題,只有Google。

首先,我要

Error: The POST Google login request must contain an id_token in the body of the request.

將JObject KeyValuePair從access_token更改為id_token后,出現此錯誤

Error: Invalid token format. Expected Envelope.Claims.Signature.

這是我的代碼:

jO = new JObject();
jO.Add("id_token", accessToken);
user = await client.LoginAsync(MobileServiceAuthenticationProvider.Google, jO);

問題已解決。 Azure移動服務API文檔已過時

JObject不為Google oauth提供者使用access_token的namevaluepair,而是使用id_token。 從令牌終結點檢索access_token時,將需要讀取id_token值,然后將其用於Azure移動服務客戶端.LoginAsync()方法。

JObject jO = new JObject();
jO.Add("id_token", googleToken.id_token);
// googleToken is my own custom class for handling the json response from Google Token endpoint
user = await client.LoginAsync(MobileServiceAuthenticationProvider.Google, jO);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM