0
我首先會說我確定這只是我,因爲人們可能無需編輯ADAL 4 Android庫而無需編輯源代碼即可開箱即用。ADAL 4 Android未通過客戶端祕密
當運行示例程序和使用令牌進行身份驗證時,我從AZURE得到一個錯誤消息,它沒有在消息正文中傳遞client_secret。我可以證實這實際上是這種情況 - 它不是通過client_secret。
雖然如果我編輯OAuth2.java文件並更改方法buildTokenRequestMessage爲類似的工作流程下完美的作品
public String buildTokenRequestMessage(String code) throws UnsupportedEncodingException {
String message = String.format("%s=%s&%s=%s&%s=%s&%s=%s&%s=%s",
AuthenticationConstants.OAuth2.GRANT_TYPE,
StringExtensions.URLFormEncode(AuthenticationConstants.OAuth2.AUTHORIZATION_CODE),
AuthenticationConstants.OAuth2.CODE, StringExtensions.URLFormEncode(code),
AuthenticationConstants.OAuth2.CLIENT_ID,
StringExtensions.URLFormEncode(mRequest.getClientId()),
AuthenticationConstants.OAuth2.REDIRECT_URI,
StringExtensions.URLFormEncode(mRequest.getRedirectUri())
// these are the two lines I've added to make it work
AuthenticationConstants.OAuth2.CLIENT_SECRET,
StringExtensions.URLFormEncode("<MY CLIENT SECRET>")
);
return message;
}
難道我做錯了什麼?如果不是,訪問客戶機密的正確方法是什麼?
我的實現是直接從演示應用程序中進行的,只是設置了字符串以匹配我的端點。
感謝