CompactToken parsing failed with error

Udai Goyal 6 Reputation points
2022-07-28T20:33:36.9+00:00

Hi Support,
I am trying to get the list of the documents from the "https://graph.microsoft.com/v1.0/me/drive/root/delta" api in the swift, but i am getting the error of "CompactToken parsing failed with error code: 80049217", please help us to get rid of this issue, and i'll be very thankful to you if you give us some sample code of swift to get the list of all files of one drive account.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,360 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ShivaniRai-MSFT-7217 2,741 Reputation points
    2022-07-29T12:20:33.483+00:00

    Hi @Udai Goyal ,

    I am able to replicate this issue at my end and resolved this error by following this documentation. This error happens when the token used is invalid, (“Bearer”+space+token )this is the correct way to pass like a parameter the token.
    I am attaching screenshot from Postman for your reference:

    • Without space between Bearer and token:

    226183-image.png

    • After giving space between Bearer and token:

    226049-image.png

    Similar Post: https://github.com/OneDrive/onedrive-api-docs/issues/785

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


  2. iz111 86 Reputation points
    2023-03-15T14:18:00.03+00:00

    I am facing the same issue.
    My code works perfectly on my development machine. I tried to upload file to OneDrive using Microsoft.Graph API (BaseClient and LargeFileUploadTask ) and without API using REST. Both works fine.

    On my other to machines I got this error with Microsoft.Graph:
    CompactToken parsing failed with error code: 80049217

    And with REST is says "Unauthorized".

    On all machines I successfully got access token using same code.

    In case of REST upload the bearer is set as:

         var httpClient = new HttpClient();      
         httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", <accesstoken>);
    
    

    What am I missing here? How to solve that?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.