我正在尝试验证针对Azure Active Directory的Android应用程序,以验证用户并最终使用示例代码here访问Office 365托管的Sharepoint列表。但每次我尝试这样做时,我都会得到一个com.microsoft.aad.adal.AuthenticationException
:活动未解决。验证清单文件中的活动名称。身份验证上下文错误意图未解决
是否有立即显而易见的事情,我做错了,还是有什么,我完全失踪?
这是我的onCreate
方法
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dud);
AuthenticationCallback <AuthenticationResult> callback = new AuthenticationCallback <AuthenticationResult>() {
@
Override
public void onSuccess(AuthenticationResult result) {
// TODO Auto-generated method stub
Log.d("Authentication Callback", "onSuccess");
Toast.makeText(getApplicationContext(), "Success",
Toast.LENGTH_SHORT).show();
}
@
Override
public void onError(Exception exc) {
// TODO Auto-generated method stub
exc.printStackTrace();
Log.d("Authentication Callback", "onError");
Toast.makeText(getApplicationContext(), "Error",
Toast.LENGTH_SHORT).show();
}
};
try {
ctx = new AuthenticationContext(DudActivity.this,
"https://login.windows.net/mydomain.onmicrosoft.com", true);
ctx.acquireToken(DudActivity.this, resource, clientId, redirectUri,
PromptBehavior.Auto, callback);
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
这是日志
03-13 13码:08:10.025:E/AuthenticationContext(8980): DEVELOPER_ACTIVITY_IS_NOT_RESOLVED:2015 - 03-13 12:08:10-99d5c2bb-f33a-4a47-8f16-b111e528617c-Intent is not resolved ver:1.1.1 03-13 13:08:10.091:W/System.err(8980): com .microsoft.aad.adal.AuthenticationException:活动不是 已解决。验证清单文件中的活动名称03-13 13:08:10.092:W/System.err(8980):at com.microsoft.aad.adal.AuthenticationContext.localFlow(AuthenticationContext.java:1274) 03- 13 13:08:10.092:W/System.err(8980):at com.microsoft.aad.adal.AuthenticationContext.acquireTokenAfterValidation(AuthenticationContext.java:1217) 03-13 13:08:10.092:W/System。 err(8980):at com.microsoft.aad.adal.AuthenticationContext.acquireTokenLocalCall(AuthenticationContext.java:1119) 03-13 13:08:10.092:W/System.err(8980):at com.microsoft。 aad.adal.AuthenticationContext.access $ 5(AuthenticationContext.java:1082) 03-13 13:08:10.092:W/System.err(8980):at com.microsoft.aad.adal.Authenticatio nContext $ 4.call(AuthenticationContext.java:1068) 03-13 13:08:10.092:W/System.err(8980):at com.microsoft.aad.adal.AuthenticationContext $ 4.call(AuthenticationContext.java:1 ) 03-13 13:08:10.092:W/System.err(8980):at java.util.concurrent.FutureTask.run(FutureTask.java:237)03-13 13:08:10.092:W/System.err(8980):at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 03-13 13:08:10.092:W/System.err(8980):at java.util。 concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:587) 03-13 13:08:10.092:W/System.err(8980):at java.lang.Thread.run(Thread.java:818)03 -13 13:08:10.092: D /认证回调( 8980):onError
是的!谢谢你为我工作。我还注意到,'acquireToken'方法有一个重载,它不需要传递上下文,这也适用于我。 – Yus 2015-03-17 09:56:36