Giter Site home page Giter Site logo

azure-samples / active-directory-android Goto Github PK

View Code? Open in Web Editor NEW
34.0 59.0 30.0 199 KB

An android app that uses Azure AD and the ADAL library for authenticating the user and calling a web API using OAuth 2.0 access tokens.

Java 100.00%
android-app aad microsoft identity azure-active-directory adal mobile

active-directory-android's Introduction

ADAL Android Microsoft Graph API Sample

There's a newer version of this sample taking advantage of the Microsoft identity platform (formerly Azure AD v2.0)

Check it out: https://github.com/azure-samples/ms-identity-android-native

If you really need to access this Azure AD v1.0, you can navigate to the master branch, but please know that it's no longer supported.

active-directory-android's People

Contributors

abraham-knowit avatar danieldobalian avatar jmprieur avatar kjyam98 avatar kreedula avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

active-directory-android's Issues

how to set broker true?

i want to open microsoft authenticator app while click call graph api so how do i set broker true in sample code?

SSO unable to get token Android.

I tried to attempt sso using the app in azure portal which is configure for web. I used same Application ID and REDIRECT_URI.
It prompt for azure login after valid login credentials sample application got crashed with following error.

AcquireTokenRequestHandlerThread
Process: com.azuresamples.azureadsampleapp.azureadsampleapp, PID: 25438
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Exception.toString()' on a null object reference

Cannot build

The main pom.xml refers to a missing parent artifact:

  <parent>
    <groupId>com.microsoft.aad</groupId>
    <artifactId>adal-aggregator</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

As a result, the project cannot be built; any help?

How to know if MFA is enabled or not?

Hi,

I have implemented Microsoft sign-in just the way it is in this sample app. However, i am not able to get the urls back from the webview, or even not able to identify if the user email address is mfa enabled or not. Is there a way this can be detected?

pls assist

Thans

how can i login with microsoft Account?

i used this demo but its giving this error.
whats problem is there i don`t understand please help me.
AADSTS50020: We are unable to issue tokens from this api version for a Microsoft account. Please contact the application vendor as they need to use version 2.0 of the protocol to support this.

TodoActivity fails to start

After manually fixing this issue #4, I ran the TodoActivity which fails to start and throws an error Unfortunately, Tiny TODO has stopped. Below is the trace from LogCat

07-21 18:49:26.016: I/Process(3480): Sending signal. PID: 3480 SIG: 9
07-21 18:50:17.616: D/dalvikvm(3684): Late-enabling CheckJNI
07-21 18:50:17.766: D/dalvikvm(3684): GC_FOR_ALLOC freed 224K, 2% free 16979K/17236K, paused 10ms, total 10ms
07-21 18:50:17.786: I/dalvikvm(3684): Could not find method android.support.v4.content.LocalBroadcastManager.getInstance, referenced from method com.microsoft.aad.adal.AuthenticationContext.cancelAuthenticationActivity
07-21 18:50:17.786: W/dalvikvm(3684): VFY: unable to resolve static method 147: Landroid/support/v4/content/LocalBroadcastManager;.getInstance (Landroid/content/Context;)Landroid/support/v4/content/LocalBroadcastManager;
07-21 18:50:17.786: D/dalvikvm(3684): VFY: replacing opcode 0x71 at 0x0053
07-21 18:50:17.786: D/PRNGFixes(3684): No need to apply the fix
07-21 18:50:17.786: D/PRNGFixes(3684): No need to apply the fix
07-21 18:50:17.796: V/DefaultTokenCacheStore(3684): Started to initialize storage helper
07-21 18:50:17.796: V/DefaultTokenCacheStore(3684): Finished to initialize storage helper
07-21 18:50:17.796: V/AuthenticationContext(3684): CorrelationId generated a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.796: V/AuthenticationContext(3684): Sending async task from thread:3684
07-21 18:50:17.796: V/AuthenticationContext(3684): Running task in thread:3713
07-21 18:50:17.796: V/AuthenticationContext(3684): Token request started CorrelationId: a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.806: W/BrokerProxy(3684): DEVELOPER_BROKER_PERMISSIONS_MISSING:Broker related permissions are missing for GET_ACCOUNTS, MANAGE_ACCOUNTS, USE_CREDENTIALS
07-21 18:50:17.806: V/AuthenticationContext(3684): Checking refresh tokens CorrelationId: a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.806: V/AuthenticationContext(3684): Looking for regular refresh token CorrelationId: a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.806: V/AuthenticationContext(3684): Looking for Multi Resource Refresh token CorrelationId: a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.806: V/AuthenticationContext(3684): Refresh token is not available CorrelationId: a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.806: V/AuthenticationContext(3684): Starting Authentication Activity with callback:1113993168 CorrelationId: a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.806: V/AuthenticationContext(3684): Put waiting request: 1113993168 CorrelationId: a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:17.826: I/Adreno-EGL(3684): <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
07-21 18:50:17.846: D/OpenGLRenderer(3684): Enabling debug mode 0
07-21 18:50:17.936: D/ToDoActivity(3684): TODOActivity onPause
07-21 18:50:17.976: I/dalvikvm(3684): Could not find method android.support.v4.content.LocalBroadcastManager.getInstance, referenced from method com.microsoft.aad.adal.AuthenticationActivity.onCreate
07-21 18:50:17.976: W/dalvikvm(3684): VFY: unable to resolve static method 147: Landroid/support/v4/content/LocalBroadcastManager;.getInstance (Landroid/content/Context;)Landroid/support/v4/content/LocalBroadcastManager;
07-21 18:50:17.976: D/dalvikvm(3684): VFY: replacing opcode 0x71 at 0x015d
07-21 18:50:17.976: I/dalvikvm(3684): Could not find method android.support.v4.content.LocalBroadcastManager.getInstance, referenced from method com.microsoft.aad.adal.AuthenticationActivity.onPause
07-21 18:50:17.976: W/dalvikvm(3684): VFY: unable to resolve static method 147: Landroid/support/v4/content/LocalBroadcastManager;.getInstance (Landroid/content/Context;)Landroid/support/v4/content/LocalBroadcastManager;
07-21 18:50:17.976: D/dalvikvm(3684): VFY: replacing opcode 0x71 at 0x000e
07-21 18:50:17.976: I/dalvikvm(3684): Could not find method android.support.v4.content.LocalBroadcastManager.getInstance, referenced from method com.microsoft.aad.adal.AuthenticationActivity.onResume
07-21 18:50:17.976: W/dalvikvm(3684): VFY: unable to resolve static method 147: Landroid/support/v4/content/LocalBroadcastManager;.getInstance (Landroid/content/Context;)Landroid/support/v4/content/LocalBroadcastManager;
07-21 18:50:17.976: D/dalvikvm(3684): VFY: replacing opcode 0x71 at 0x003b
07-21 18:50:17.996: V/WebViewChromium(3684): Binding Chromium to the background looper Looper (main, tid 1) {425f2d58}
07-21 18:50:17.996: I/chromium(3684): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
07-21 18:50:17.996: I/BrowserProcessMain(3684): Initializing chromium process, renderers=0
07-21 18:50:18.006: W/chromium(3684): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
07-21 18:50:18.016: D/dalvikvm(3684): GC_FOR_ALLOC freed 243K, 2% free 17248K/17524K, paused 10ms, total 10ms
07-21 18:50:18.046: V/AuthenticationActivity(3684): Packagename:com.microsoft.aad.test.todoapi Broker packagename:com.microsoft.workaccount Calling packagename:com.microsoft.aad.test.todoapi
07-21 18:50:18.046: D/AuthenticationActivity(3684): OnCreate redirectUrl:https://aadadfstodolistservice.azurewebsites.net
07-21 18:50:18.056: V/AuthenticationActivity(3684): User agent:Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
07-21 18:50:18.056: V/AuthenticationActivity(3684): Init broadcastReceiver with requestId:1113993168 Request authority:https://login.windows.net/aadadfs.onmicrosoft.com resource:https://aadadfs.onmicrosoft.com/TodoListService clientid:e3786e2a-0dcb-449a-8eba-b4042c9bec01 correlationId:a7cf25eb-f93e-4d65-8d3e-85ae530b2cfe
07-21 18:50:18.056: D/AndroidRuntime(3684): Shutting down VM
07-21 18:50:18.056: W/dalvikvm(3684): threadid=1: thread exiting with uncaught exception (group=0x415a1ba8)
07-21 18:50:18.066: E/AndroidRuntime(3684): FATAL EXCEPTION: main
07-21 18:50:18.066: E/AndroidRuntime(3684): Process: com.microsoft.aad.test.todoapi, PID: 3684
07-21 18:50:18.066: E/AndroidRuntime(3684): java.lang.NoClassDefFoundError: android.support.v4.content.LocalBroadcastManager
07-21 18:50:18.066: E/AndroidRuntime(3684): at com.microsoft.aad.adal.AuthenticationActivity.onCreate(AuthenticationActivity.java:219)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.app.Activity.performCreate(Activity.java:5231)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.app.ActivityThread.access$800(ActivityThread.java:135)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.os.Handler.dispatchMessage(Handler.java:102)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.os.Looper.loop(Looper.java:136)
07-21 18:50:18.066: E/AndroidRuntime(3684): at android.app.ActivityThread.main(ActivityThread.java:5017)
07-21 18:50:18.066: E/AndroidRuntime(3684): at java.lang.reflect.Method.invokeNative(Native Method)
07-21 18:50:18.066: E/AndroidRuntime(3684): at java.lang.reflect.Method.invoke(Method.java:515)
07-21 18:50:18.066: E/AndroidRuntime(3684): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-21 18:50:18.066: E/AndroidRuntime(3684): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-21 18:50:18.066: E/AndroidRuntime(3684): at dalvik.system.NativeStart.main(Native Method)
07-21 18:50:19.816: I/Process(3684): Sending signal. PID: 3684 SIG: 9

2 errors in ToDoActivity

I can build the Authentication activity as well as the hello app fine. The TodoActivity results in 2 errors

Description Resource Path Location Type
The type com.google.gson.Gson cannot be resolved. It is indirectly referenced from required .class files MobileServiceTable.java /ToDoActivity/src/com/azure/webapi line 1 Java Problem
The project was not built since its build path is incomplete. Cannot find the class file for com.google.gson.Gson. Fix the build path then try building this project ToDoActivity Unknown Java Problem

RESOURCE_ID not always a URI

AuthenticationActivity has leaked window org.chromium.content.browser.input.PopupTouchHandleDrawable

I ran the TaskApplication-AndroidStudio sample. Without changing anything as soon as I ran it and tried to log in I got the following

09-24 11:18:10.091      314-314/com.microsoft.aad.taskapplication E/WindowManager﹕ android.view.WindowLeaked: Activity com.microsoft.aad.adal.AuthenticationActivity has leaked window org.chromium.content.browser.input.PopupTouchHandleDrawable{3d923a03 V.ED.... ........ 0,0-141,174} that was originally added here
            at android.view.ViewRootImpl.<init>(ViewRootImpl.java:363)
            at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:271)
            at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
            at android.widget.PopupWindow.invokePopup(PopupWindow.java:1104)
            at android.widget.PopupWindow.showAtLocation(PopupWindow.java:933)
            at android.widget.PopupWindow.showAtLocation(PopupWindow.java:897)
            at org.chromium.content.browser.input.PopupTouchHandleDrawable.show(PopupTouchHandleDrawable.java:354)
            at org.chromium.android_webview.AwContents.nativeOnDraw(Native Method)
            at org.chromium.android_webview.AwContents.access$4100(AwContents.java:94)
            at org.chromium.android_webview.AwContents$AwViewMethodsImpl.onDraw(AwContents.java:2729)
            at org.chromium.android_webview.AwContents.onDraw(AwContents.java:1180)
            at com.android.webview.chromium.WebViewChromium.onDraw(WebViewChromium.java:1718)
            at android.webkit.WebView.onDraw(WebView.java:2393)
            at android.view.View.draw(View.java:15231)
            at android.view.View.updateDisplayListIfDirty(View.java:14167)
            at android.view.View.getDisplayList(View.java:14189)
            at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
            at android.view.View.updateDisplayListIfDirty(View.java:14127)
            at android.view.View.getDisplayList(View.java:14189)
            at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
            at android.view.View.updateDisplayListIfDirty(View.java:14127)
            at android.view.View.getDisplayList(View.java:14189)
            at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
            at android.view.View.updateDisplayListIfDirty(View.java:14127)
            at android.view.View.getDisplayList(View.java:14189)
            at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3389)
            at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3368)
            at android.view.View.updateDisplayListIfDirty(View.java:14127)
            at android.view.View.getDisplayList(View.java:14189)
            at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273)
            at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279)
            at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:318)
            at android.view.ViewRootImpl.draw(ViewRootImpl.java:2530)
            at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2352)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1982)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
            at android.view.Choreographer.doCallbacks(Choreographer.java:580)
            at android.view.Choreographer.doFrame(Choreographer.java:550)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5254)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

And the login failed...

This is happening in my application as well, what do I need to do differently?

validateClass() not working as expected

I have a class called Assignment which extended an abstract class TableData. Because my id, version ,etc was defined in TableData, I did not define it again in Assignment but the validateClass() in the MobileServiceClient class kept giving the error "The class representing the MobileServiceTable must have a single id property defined". The problem was that it only checked for fields in the class itself not the TableData class.
I tried changing the TableData class to non-abstract class but it still did not work

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.