none
Android RRS feed

  • Question

  • Hi,

    I am using Outlook Mail Rest API V2.0 for Android including 'com.microsoft.services:outlook-services:2.1.0' library within the app. For authentication I am using mAuthContext.acquireToken() function. First time the authentication works and in response I am getting the access token. I guess all the auth token received in response is stored in cache maintained by the library. Next time when I call .acquireToken() the API throws the following exception while initializing the auth context.    

                                                                         

    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
     at com.microsoft.aad.adal.TokenCacheKey.hashCode(TokenCacheKey.java:294)
    at sun.misc.Hashing.singleWordWangJenkinsHash(Hashing.java:48)
    at java.util.HashMap.put(HashMap.java:423)
    at com.microsoft.aad.adal.TokenCache.deSerialize(TokenCache.java:151)
    at com.microsoft.aad.adal.TokenCache.initCache(TokenCache.java:335)
    at com.microsoft.aad.adal.AuthenticationContext.<init>(AuthenticationContext.java:134)

    Which is why the loading of the details fails and it re authenticates again and again getting the access token each time.

    What may be the issue? 

    Thanks in advance

    Tuesday, March 21, 2017 4:36 AM

All replies

  • Hello,

    This forum (Outlook for Developers) is for development issues related to Outlook Object Model and Office 365 for Developers is for issues about Office 365 Graph API and Office 365 REST API, so I would move this thread into Office 365 for Developers forum.

    Thanks for your understanding.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 22, 2017 1:55 AM
    Moderator
  • Thanks Celeste.

    All the replies I can see in this thread? or should I be visiting some other link?

    Thanks in advance

    Wednesday, March 22, 2017 9:43 AM
  • The thread has been moved, so you could see all the replies in this thread.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 22, 2017 10:14 AM
    Moderator
  • Hi,

    You can refer to the ADAL for Android SDK for samples and sources on GitHub: https://github.com/AzureAD/azure-activedirectory-library-for-android. Maybe you have missed a step in the authentication process.

    If this doesn't answer your question, please provide your code. I need some more information then only the error message.

    Thanks!


    Regards, Sjoukje

    Please remember to click 'Mark as Answer' on the post that helps you.


    Monday, March 27, 2017 9:04 AM
    Moderator
  • Hi,

    I am using ADAL sdk version 2.0, the github link that you shared has sample wrt V1.0. Please provide link for sdk v2.0 samples that has functionality to get refresh token etc,

    To get app id, i registered my app using the following site https://apps.dev.microsoft.com/ which supports V2.0 only I guess

    Thanks

    Rashmi Mathur

    Tuesday, March 28, 2017 12:21 PM
  • Hi,

    Check this link: https://dev.outlook.com/restapi/tutorial/android .

    Maybe you are a bit early using the v2.0. As you can see on the page I've provided above, they are still working on samples for the v2.0 version. Can't you use the v.10 instead and upgrade when there is more information on the new version?


    Regards, Sjoukje

    Please remember to click 'Mark as Answer' on the post that helps you.

    Thursday, March 30, 2017 8:04 AM
    Moderator
  • I need notification which is why I have to use V2 API

    I found the following issue with V2 API

                                                                                             

    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
    at com.microsoft.aad.adal.TokenCacheKey.hashCode(TokenCacheKey.java:294)
    at sun.misc.Hashing.singleWordWangJenkinsHash(Hashing.java:48)
    at java.util.HashMap.put(HashMap.java:423)
    at com.microsoft.aad.adal.TokenCache.deSerialize(TokenCache.java:151)
    at com.microsoft.aad.adal.TokenCache.initCache(TokenCache.java:335)
    at com.microsoft.aad.adal.AuthenticationContext.<init>(AuthenticationContext.java:134)

    On authentication request, the scope list sent from server is empty. So next time while validating the user details, API throws the following exception as the scope is empty(where as it is a mandatory field).

    Can the development team rectify this issue, so that I can continue working with V2.

    Thanks in Advance

    Rashmi Mathur


    Monday, April 24, 2017 6:42 AM