openid / openid/AppAuth-iOS

Is it possible to get fresh token synchronously?

Open
#667 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C
Stars
2k
Forks
867
Avg merge
4d 48m
Merged PRs (30d)
1

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing -[performActionWithFreshTokens:additionalRefreshParameters:dispatchQueue:] and OIDAuthorizationService performTokenRequest:originalAuthorizationResponse:callback:. Determine whether the existing entry points support the requested synchronous behavior without blocking the main thread; completion should establish a supported approach or clearly document the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
authentication, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.