openid / openid/AppAuth-iOS

NSKeyedUnarchiver.unarchivedObject(ofClass: OIDAuthState.self, from: decoded) not work

Open
#684 2 comments 8 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

Hi there,
I have some bug with this package on macOS target:
After stored data with methods:
let encodedData = try NSKeyedArchiver.archivedData(withRootObject: authState!, requiringSecureCoding: false)
defaults.set(encodedData, forKey: kAuthorizerKey)
and unachieved with method:
if let decoded = defaults.object(forKey: kAuthorizerKey) as? Data {
do {
let auth = try NSKeyedUnarchiver.unarchiveObject(with: decoded) as? OIDAuthState
all work fine. But last method is deprecated.
When I replaced last method with:
let auth = try NSKeyedUnarchiver.unarchivedObject(ofClass: OIDAuthState.self, from: decoded)
this failed with message in debugger area:
*** Assertion failure in -[OIDAuthorizationRequest initWithConfiguration:clientId:clientSecret:scope:redirectURL:responseType:state:nonce:codeVerifier:codeChallenge:codeChallengeMethod:additionalParameters:], OIDAuthorizationRequest.m:147
2022-02-07 12:34:31.759062+0200 TestApp[23341:1292333] The response_type "(null)" isn't supported. AppAuth only supports the "code" or "code id_token" response_type.

Does anyone know how to fix this?
Thanks!

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 comparing NSKeyedUnarchiver.unarchiveObject(with:) with unarchivedObject(ofClass:from:) using the reproduction in the issue. Inspect OIDAuthorizationRequest.m at line 147 and the OIDAuthState archive/unarchive path; done means the secure-coding API restores OIDAuthState without the null response_type assertion.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, objective-c, swift
Domain
authentication, desktop-dev, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.