Skip to content

Is it possible to get fresh token synchronously? #667

@h3dkandi

Description

@h3dkandi

From what I gathered all callbacks in the -[performActionWithFreshTokens] function are performed on the main tread/queue.

Even if I use -[performActionWithFreshTokens:additionalRefreshParameters:dispatchQueue:] that will only execute my callback/action on the specified thread. There is still logic inside the method that dispatches to the main tread/queue. It calls -[OIDAuthorizationService performTokenRequest:originalAuthorizationResponse:callback:] which dispatches its callback on the main thread.

This in turn stops me from hacking the method to become synchronous by blocking the main thread and waiting for my callback. Because if I block it the underlying logic that has dispatches on the main thread won't run. (I know blocking main thread is bad but I will live with it if it does the job)

I understand that for my problem to be solved AppAuth should not execute everything on the main thread. Currently because AppAuth is not thread safe that can not be done. Probably making it thread safe is a huge task.

Is there a way that I can currently do what I want even in a hacky way?

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