[GH-ISSUE #1542] iOS/Swift Sign In with Apple #8806

Closed
opened 2026-04-13 04:01:06 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @CodeWithShreyans on GitHub (Feb 23, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1542

I'm building a SwiftUI app that uses Sign In with Apple and needs to authenticate with my server on each request.

The first step from what I can understand is:
Trigger Sign In with Apple on the client, send the idToken to the server and pass it to authClient.signIn.social.

But I can't figure how to give the client something (possibly a JWT) that it can send with requests to my server and I can verify it and process the request.

Originally created by @CodeWithShreyans on GitHub (Feb 23, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1542 I'm building a SwiftUI app that uses Sign In with Apple and needs to authenticate with my server on each request. The first step from what I can understand is: Trigger Sign In with Apple on the client, send the idToken to the server and pass it to `authClient.signIn.social`. But I can't figure how to give the client something (possibly a JWT) that it can send with requests to my server and I can verify it and process the request.
GiteaMirror added the locked label 2026-04-13 04:01:06 -05:00
Author
Owner

@productdevbook commented on GitHub (Feb 23, 2025):

I think a package for swift would be much more useful.

<!-- gh-comment-id:2676570692 --> @productdevbook commented on GitHub (Feb 23, 2025): I think a package for swift would be much more useful.
Author
Owner

@CodeWithShreyans commented on GitHub (Feb 23, 2025):

Yeah but that's asking contributors for a lot of work. I just want a solution that may not be the easiest but works.

<!-- gh-comment-id:2676654101 --> @CodeWithShreyans commented on GitHub (Feb 23, 2025): Yeah but that's asking contributors for a lot of work. I just want a solution that may not be the easiest but works.
Author
Owner

@CodeWithShreyans commented on GitHub (Feb 23, 2025):

@Bekacru Would #1515 be a better solution to this?

<!-- gh-comment-id:2677080471 --> @CodeWithShreyans commented on GitHub (Feb 23, 2025): @Bekacru Would #1515 be a better solution to this?
Author
Owner

@Bekacru commented on GitHub (Feb 23, 2025):

Apple sing in should be accomplished through the id token. After you authenticate with signIn.social the response should contain token that you can stroe and send on subsequent requests as a bearer header. Make sure to use the bearer plugin so the server can read it (by default it only reads cookies).

<!-- gh-comment-id:2677087339 --> @Bekacru commented on GitHub (Feb 23, 2025): Apple sing in should be accomplished through the id token. After you authenticate with `signIn.social` the response should contain `token` that you can stroe and send on subsequent requests as a bearer header. Make sure to use the [bearer plugin](https://www.better-auth.com/docs/plugins/bearer) so the server can read it (by default it only reads cookies).
Author
Owner

@CodeWithShreyans commented on GitHub (Feb 23, 2025):

And this token doesn't expire?

<!-- gh-comment-id:2677088308 --> @CodeWithShreyans commented on GitHub (Feb 23, 2025): And this token doesn't expire?
Author
Owner

@Bekacru commented on GitHub (Feb 23, 2025):

it does depends on your session.expiresIn config but whenever you call /get-session with the token, its age gets extended.

<!-- gh-comment-id:2677089988 --> @Bekacru commented on GitHub (Feb 23, 2025): it does depends on your `session.expiresIn` config but whenever you call `/get-session` with the token, its age gets extended.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8806