Skip to content

Internal refresh of a 3-legged token passed into the work item failed #103

@k065167

Description

@k065167

I could pass into the work item my 3-legged token like this:

Dictionary<string, string> authHeader = new Dictionary<string, string> { { "Authorization", $"Bearer {token}" } };

WorkItem workItem = new WorkItem()
{
    ActivityId = activityId,
    Arguments = new Dictionary<string, IArgument>
    {
        { "params", new XrefTreeArgument { Verb=Verb.Get, Url = jsonStorageId, Headers = authHeader } },
        { "results", new XrefTreeArgument { Verb=Verb.Put, Url = zipStorageId, Headers = authHeader } },
        { "adsk3LeggedToken", new StringArgument() { Value = token }},
    },
};

The work item can then access Revit files on ACC. However, my task involves reloading a large number of Revit links inside the main Revit model. This works most of the time, but sometimes it fails while loading a link. The report shows this:

[06/10/2025 17:57:20] Starting work item 9bba884a75694cc5be13089881367581
...
[06/10/2025 20:22:25] at DesignAutomationFramework.RevitOAuth2AccessTokenCallback.ResetToken(String token)
[06/10/2025 20:22:25] at DesignAutomationFramework.RevitOAuth2AccessTokenCallback.RefreshToken()
[06/10/2025 20:22:25] at DesignAutomationFramework.RevitOAuth2AccessTokenCallback.RefreshOAuth2Token(Boolean waitToFinish).
[06/10/2025 20:22:44] Autodesk.Revit.Exceptions.RevitServerUnauthenticatedUserException: User is not sign in to Autodesk 360.
[06/10/2025 20:22:44] at Autodesk.Revit.DB.RevitLinkType.LoadFrom(ModelPath path, WorksetConfiguration config)

This is really strange because it could load several links with proper authentication, and then just randomly failed to refresh the token!

You can also see from the log that the work item had been running fine for over 2 hours before getting the error, so the token refresh must have worked previously in that same work item?

I'm lost here on what can fix this, so will really appreciate any help 😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions