1

I am trying to get my office365 planner task using the Microsoft Graph API but I am getting below error:

GET https://graph.microsoft.com/beta/me/tasks

{
  "error": {
    "code": "InvalidAuthenticationToken",
    "message": "Bearer access token is empty.",
    "innerError": {
      "request-id": "4f209643-f3f6-4256-87b7-cf4f2fd489eb",
      "date": "2016-05-16T09:03:33"
    }
  }
}

2 Answers 2

3

The error message is pretty self-explanatory,

"message": "Bearer access token is empty."

You need to be authenticated before you can make this RESTful API call.

If you're developing your own app, follow this tutorial to learn about OAuth2 workflow, http://graph.microsoft.io/en-us/docs/platform/rest

If you're using Graph Explore, make sure you're logged in before call that API.

Sign up to request clarification or add additional context in comments.

5 Comments

When i try to login through Graph Explore it gives me below error AADSTS90093: Calling principal cannot consent due to lack of permissions. What are the steps need to be perform for getting permission , please suggest as i am new to Graph-API and Azure AD.
Are you logged in as an admin user? You need to log in as an admin or try to consent the user with the proper rights.
Hi Jackie : I tried login with admin user too for sign in but same error . also where & how can i consent the user with proper rights ? kindly note i am accessing the api through Graph Explore .
Any updates on this? Really frustrating that MS doesn't provide any easy way to test MS Graph....
Update : You, now, have a link to modify your rights from graph explorer, but it generate an error when attempting (even with tenant admin account). Cheers
0

I use this Controller's action code for granting admin consent:

//<Summary>
    //Used to grant admin consent to Azure AD apps
    //</Summary>
    public virtual ActionResult AdminConsentApp()
    {
        string strResource = "https://graph.microsoft.com";
        string strRedirectController = "https://localhost:[my local debug port number]";

        string authorizationRequest = String.Format(
            "https://login.windows.net/common/oauth2/authorize?response_type=code&client_id={0}&resource={1}&redirect_uri={2}&prompt={3}",
                Uri.EscapeDataString(SettingsHelper.ClientId),
                Uri.EscapeDataString(strResource),
                Uri.EscapeDataString(String.Format("{0}", strRedirectController)),
                Uri.EscapeDataString("admin_consent")
                );

        return new RedirectResult(authorizationRequest);
    }

Hope this help, Cheers, Danfer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.