Why is the token returned by ADAL token showing unauthorised on a request made by Postman and how do i resolve it? RRS feed

  • Question

  • I want to make API calls to the Azure Blockchain Workbench from my python app. For that the API calls need a Authorisation bearer. When I get the bearer from the Azure UI Webapp using Inspect Element, the same token bearer works fine with the API calls. However, the bearer returned by ADAL in Python when used in the API call shows 401 unauthorised.

    For the Inspect Element part, I get my token by logging in to and then using inspect element.

    In the python part, here is my code

    import adal
    import swagger_client
    from swagger_client.api_client import ApiClient
    context = adal.AuthenticationContext("",api_version=None)
    token = context.acquire_token_with_username_password(resource='',username="",password="pass",client_id=client_id)

    I would like to get an authentication bearer in python that i can further use with the API calls

    Friday, August 9, 2019 1:44 PM


  • Posting the response you got from StackOverflow for future reference:

    token = context.acquire_token_with_username_password(resource=client_id,username="",password="pass",client_id=client_id)

    source link:

    Wednesday, August 14, 2019 7:19 PM