Skip to content

Comments

fix: user issue#4

Merged
sirily11 merged 1 commit intomainfrom
user
Feb 8, 2026
Merged

fix: user issue#4
sirily11 merged 1 commit intomainfrom
user

Conversation

@sirily11
Copy link
Contributor

@sirily11 sirily11 commented Feb 8, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 8, 2026 09:20
@sirily11 sirily11 enabled auto-merge (squash) February 8, 2026 09:20
@sirily11 sirily11 merged commit 62b8cbb into main Feb 8, 2026
6 checks passed
@sirily11 sirily11 deleted the user branch February 8, 2026 09:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the User model decoding to better interoperate with OIDC-style userinfo responses (e.g., sub/picture) and adds a small repo hygiene tweak.

Changes:

  • Add custom Codable implementation for User to accept id or sub, and image or picture.
  • Minor Package.swift manifest formatting adjustments.
  • Ignore .env files via .gitignore.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
Sources/RxAuthSwift/AuthenticationState.swift Adds custom User decoding/encoding to support alternate JSON field names (sub, picture).
Package.swift Removes trailing commas / normalizes manifest formatting in dependency lists.
.gitignore Adds .env to ignored files to avoid committing local environment secrets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

self.email = try container.decodeIfPresent(String.self, forKey: .email)
// Support both "image" and "picture" (OIDC standard) for profile image
self.image = try container.decodeIfPresent(String.self, forKey: .image)
?? container.decodeIfPresent(String.self, forKey: .picture)
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won’t compile: the second decodeIfPresent call in the nil-coalescing expression is also throwing, but it isn’t prefixed with try (Swift requires try for each throwing call, or try applied to the whole expression). Add try (or restructure) so both decode attempts are handled correctly.

Suggested change
?? container.decodeIfPresent(String.self, forKey: .picture)
?? try container.decodeIfPresent(String.self, forKey: .picture)

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +37
// Support both "id" and "sub" (OIDC standard) for user identifier
if let id = try container.decodeIfPresent(String.self, forKey: .id) {
self.id = id
} else if let sub = try container.decodeIfPresent(String.self, forKey: .sub) {
self.id = sub
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New decoding behavior supports sub and picture, but current tests only cover round-tripping id and image. Add unit tests that decode JSON payloads containing only sub (no id) and only picture (no image) to ensure this compatibility stays working.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant