May 14, 2025

๐Ÿง‘‍๐Ÿ’ป Why Apple SSO Doesn't Return First and Last Name After First Login (and How to Handle It)

Single Sign-On (SSO) has become the gold standard for seamless user authentication. With providers like Google, Facebook, and Apple, integrating social login has never been easier. But when using Apple SSO, many developers face a confusing issue:

After the first login, Apple no longer returns the user's first and last name.

This behavior isn't a bug — it's by design. In this blog, we’ll dive into:

  • Why Apple behaves this way

  • How it's different from Google and Facebook

  • How to fix it in your app

  • Whether you can use Apple’s private relay email for OTP/communication


๐Ÿ Why Apple Doesn’t Return Name After First Login — By Design

Apple is known for putting user privacy first, and its SSO implementation reflects that.

When a user signs in using Apple for the first time, Apple returns the given_name, family_name, and optionally the email. However, subsequent logins will not return the name again, regardless of scopes.

๐Ÿ“œ Apple Developer Docs:
“Apple only shares user information such as name and email once, during the initial authorization.”

This is intentional to:

  • Minimize personal data shared with third-party apps

  • Give users complete control over their identity

  • Ensure developers store data responsibly


๐Ÿ” Why This Is Not an Issue with Google or Facebook

Both Google and Facebook take a more traditional OAuth 2.0 approach. When requested via appropriate scopes (profile, email), they consistently return:

  • First name

  • Last name

  • Profile picture

  • Email

Feature Apple Google / Facebook
Name returned always ❌ Only on first login ✅ On every login
Email always returned ✅ Yes (if allowed) ✅ Yes
Can hide real email ✅ Yes (private relay option) ❌ No
Privacy-first approach ✅ Very strict ❌ Less strict

๐Ÿ› ️ How to Fix the Missing Name Issue

To build a robust Apple SSO integration, here’s what you should do:

✅ 1. Store the Name at First Login

After the first login, extract and persist the name in your backend.

Map<String, Object> claims = decodeJwt(appleIdToken);
String firstName = (String) claims.get("given_name");
String lastName = (String) claims.get("family_name");

if (firstName != null && lastName != null) {
    userService.saveUserName(userId, firstName, lastName);
}

๐Ÿ” 2. Fetch Name From Your DB for Later Logins

Since Apple won’t send it again, use the stored name for future user sessions:

User user = userRepository.findByAppleSub(appleSub);
String name = user.getFirstName() + " " + user.getLastName();

✏️ 3. Prompt User If Name Was Never Captured

If the name wasn’t captured during the first login (e.g., due to a bug or user canceling), prompt the user to enter it manually.


๐Ÿ“ง Can You Use Apple’s Private Relay Email for OTP and Communication?

Yes! If a user chooses “Hide My Email” during Apple SSO, Apple generates a relay address like:

randomstring@privaterelay.appleid.com

✅ You Can Send OTPs and Emails to It

Apple forwards emails sent to this relay address to the user’s actual Apple ID inbox. You can use it for:

  • OTPs

  • Welcome emails

  • Password reset links

  • Transactional notifications

Apple guarantees delivery as long as your domain is registered and emails are compliant.

๐Ÿ”’ Key Considerations

Aspect Details
Relay Validity Relay remains active while the user uses your app
SPF/DKIM Required Set up email authentication to avoid spam filtering
No Marketing Emails Stick to transactional emails; avoid promotional content
Reply-to Address Set it up if you expect users to reply

๐Ÿ“ฅ Can Users Access It?

Absolutely. Users receive emails sent to @privaterelay.appleid.com in their actual inbox, just like any other email. They typically don’t see or interact with the relay address directly.


๐Ÿงฉ Bonus: How to Detect First-Time Apple Login

You can determine if it's a first-time login based on whether given_name and family_name are present in the ID token or the user JSON payload. If they're missing, it's a returning login.


๐Ÿงญ Final Thoughts

Apple's approach to SSO is driven by a strong privacy philosophy. While it may introduce some extra work for developers, it's a positive step for user data protection.

To ensure a smooth experience:

  • Store user name on first login

  • Use Apple’s private relay email confidently for OTPs and communication

  • Respect user privacy — and be ready to ask for missing info if needed


Need Help With Apple, Google, or Facebook SSO in Spring Boot or WebFlux?
I help teams build secure and privacy-conscious SSO integrations. Reach out if you’d like a tailored solution!


Would you like this in HTML format or exported as a file for publishing?

๐Ÿš€ Micronaut vs Spring Boot: The Ultimate Cloud-Native Java Showdown (AWS Lambda, EC2, Spot Instances)

  • In the age of microservices and serverless, Java still rules — but the framework you choose can dramatically impact cost, performance, and developer experience.

This blog breaks down a practical, head-to-head comparison between Micronaut and Spring Boot, with a special focus on AWS Lambda, EC2, and Spot Instances.


๐ŸŒŸ TL;DR Summary

Criteria Micronaut Spring Boot
๐Ÿš€ Startup Time Ultra-fast (20–100ms) Moderate to slow (500ms–3s)
๐Ÿ’พ Memory Usage Low (30–60MB typical) Higher (100–300MB typical)
๐Ÿง  Dependency Injection Compile-time (AOT) Runtime (reflection-heavy)
☁️ Serverless Fit ✅ Excellent for AWS Lambda ⚠️ Possible but slower cold starts
๐Ÿ’ธ Cost Efficiency ✅ Great for Spot/Lambda ⚠️ More costly in cold-start/serverless
๐Ÿ” Ecosystem Lightweight, focused Huge ecosystem, mature integrations
๐Ÿ“‰ Disadvantages Smaller community, limited plugins Slower boot, higher memory use

๐Ÿ” 1. Architecture Difference

Feature Micronaut Spring Boot
Dependency Injection AOT (compile-time) – no reflection Runtime reflection-based
Bean Instantiation Fast, direct bytecode-generated Slower due to dynamic proxies & reflection
Native Image Support First-class (GraalVM, small images) Supported but complex and large native images

Takeaway: Micronaut was built for cloud-native from the ground up, Spring Boot evolved into it.


⚡ 2. AWS Lambda: Cold Start Matters

Aspect Micronaut Spring Boot
Cold Start Time ~20–100ms (JVM), <10ms (native) ~1–3 seconds (JVM), ~700ms (native)
Memory Footprint ~30–60MB ~150–300MB
Cost Implication ✅ Lower Lambda invocation costs ⚠️ Higher cold start costs

๐Ÿ’ฐ AWS Lambda Cost Snapshot (Monthly Estimate):

Scenario: 1 million monthly invocations, 512MB memory, 1s avg runtime

Framework Monthly Cost (USD)
Micronaut ~$4.00
Spring Boot ~$10.00

๐Ÿ‘‰ Micronaut can save 2–3x costs in cold-start-heavy use cases.


๐Ÿ’ก 3. EC2 / Spot Instances: Boot Fast, Scale Faster

Area Micronaut Spring Boot
Boot Time (EC2 restart) ~300ms ~2–5 seconds
Ideal for Spot Scaling ✅ Yes ⚠️ Less ideal due to slow start
Memory Footprint (512MB RAM) ✅ Fits easily ⚠️ May require memory tuning

EC2 Cost Snapshot (t4g.small - ₹500/month baseline):

  • Micronaut allows you to pack more services per instance (lower infra cost).

  • Spring Boot might require more EC2 nodes or larger instances = higher cost.


⚖️ 4. Disadvantages: Honest Look

❌ Micronaut Disadvantages:

  • Smaller ecosystem (e.g., fewer libraries and integrations)

  • Less community support compared to Spring

  • Learning curve due to compile-time DI model

  • GraalVM native images require careful tuning (startup vs throughput)

❌ Spring Boot Disadvantages:

  • Slower startup (problematic for Lambda/serverless)

  • Higher memory use → increased cloud cost

  • Reflection-heavy = poor native image performance

  • Runtime dependency scanning slows boot


๐Ÿงช 5. Performance Benchmark (JVM)

Metric Micronaut (JVM) Spring Boot (JVM)
Startup Time ~200–400ms ~1.5–3s
Memory Usage ~50MB ~150–300MB
Throughput (req/s) High High (with warm JVM)
Native Image Time <30ms (Micronaut native) ~500–800ms (Spring Native)

๐Ÿ“Œ Micronaut shines in startup + Lambda; Spring Boot wins for always-on services with rich dependencies.


๐Ÿงฐ 6. Ecosystem & Tooling

Category Micronaut Spring Boot
CLI / Scaffolding Yes (mn CLI) Yes (spring init)
Dev Tools Hot reload (limited), Gradle/Maven DevTools, Spring Dev Launcher
Libraries REST, gRPC, Kafka, AWS SDK Huge ecosystem, legacy & modern support
IDE Support IntelliJ, VSCode IntelliJ, Eclipse, STS, VSCode

๐Ÿ“Œ 7. Ideal Use Cases

Use Case Recommended Framework
AWS Lambda ✅ Micronaut
Short-lived background jobs ✅ Micronaut
Resource-constrained environments ✅ Micronaut
Legacy migration ✅ Spring Boot
Complex integrations (JMS, JPA) ✅ Spring Boot
Large teams with Spring skills ✅ Spring Boot

๐Ÿ”ฎ 8. What's Next: Micronaut + Galvium

Micronaut’s partnership with Galvium (an upcoming JVM runtime) aims to cut JVM cold starts down to ~10mswithout native compilation.

Galvium + Micronaut could redefine how Java works in:

  • Instant cold starts

  • Serverless

  • Autoscaling pods

It’s early, but Micronaut is future-proofing Java cloud apps.


✅ Conclusion

Summary Verdict
Cloud-native design ✅ Micronaut
Mature enterprise ecosystem ✅ Spring Boot
Fast cold start and low memory ✅ Micronaut
Best for long-running heavy apps ✅ Spring Boot
Cost-efficient for AWS Lambda/EC2 ✅ Micronaut
Easier onboarding & hiring ✅ Spring Boot

๐Ÿ“ Want More?

Would you like this blog exported as:

  • ✅ Markdown (.md)

  • ✅ HTML

  • ✅ Publish-ready Medium/Dev.to format

  • ✅ With diagrams comparing startup/memory graphs

Just say the word and I’ll generate it for you!