Outlook Add-In -- 401 unauthorized (Bearer access token is empty) RRS feed

  • Question

  • I am trying to use the Microsoft Graph API in my Outlook Add-In.

    I am logged in to outlook and have installed my Add-In from a local source.

    Because of that I would assume that I can use

    Office.context.mailbox.getCallbackTokenAsync to fetch my token instead of doing the OAuth.

    However using the token and following the Microsoft Graph API does end in a 401 error..

    Here is how I am trying to call the Graph API:

    Office.context.mailbox.getCallbackTokenAsync( result => {
        console.log( result );
        const token: string = result.value;
        $.ajax( {
            headers: {
                "Authorization": "Bearer" + token
            type: "GET"
        } );
    } );
    What am I doing wrong here? Why is the token invalid?

    Tuesday, February 20, 2018 2:35 PM

All replies

  • Hello oliver_1234567890,

    This forum(Outlook for developers) is for development issue related to Outlook Object model and your issue is more related to Microsoft Graph Api, So I would move the thread to Office 365 for Developers forum.

    Thanks for understanding,

    Best Regards,


    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

    Wednesday, February 21, 2018 9:15 AM