How I replaced GTLR with a lean REST setup—token-based Google Drive integration using URLSession, safer secrets, and fewer moving parts.

GTLR is gone from my stack. I rebuilt file list, upload, and metadata calls with token-based Google Drive integration using pure REST and URLSession. The result: smaller binaries, clearer errors, and auth I actually understand. This post shows the moving pieces, pitfalls, and a copy-paste checklist you can apply today. For layout sanity while rebuilding screens, I leaned on Golden Scaling in Practice—pre-deciding anchors kept my UI and my head calm during refactors.

Why token-based Google Drive integration?

Libraries hide complexity—until they don’t. A direct REST approach gives you explicit control over scopes, refresh timing, and retries. With a short AuthService, I trade magical “it works” for transparent calls I can reason about. See my earlier context in LifeOS Dev Log: Drive Tokens & List/Grid Toggle for how this started.

Core flow for token-based Google Drive integration

  1. Sign in & get tokens. Use Google Sign-In to obtain an access token and refresh token (on first consent).
  2. Store securely. Keep tokens in Keychain; never in UserDefaults or the document.
  3. Attach bearer. Each request sets Authorization: Bearer <access_token>.
  4. Auto-refresh. On 401, refresh using the OAuth token endpoint and retry once.
  5. Call Drive v3. Hit /drive/v3/files for list/search, /upload/drive/v3/files for media.

Minimal checklist for token-based Google Drive integration

Endpoints you’ll call (REST)

The official references are clear and current: Drive API (REST) Overview and Google Identity: OAuth 2.0.

UI notes (because UX still matters)

Token work is plumbing; users feel rhythm. Anchor your headline on 3/5, your primary action (Upload / Connect) on 5/8, and stick to one gutter (8/13/21). These small rules keep “settings” screens from feeling like a spreadsheet.

Common mistakes (and quick fixes)

What I cut (and didn’t miss)

Ship it

Start by swapping your file list screen to REST calls behind an AuthService. If it feels good, move uploads and metadata next. When you hit the first 401 in the wild, you’ll be glad you understand the flow. Download the starter snippet for URLSession + refresh and make your Drive calls boring—in the best way.

- randomblink

Drive Previews, Tag Chips, and Faster List↔Grid

Previews that land sooner, tags that filter smarter, and a list/grid toggle that stops jumping.

1) Drive previews: sooner, safer

Tech: Google Drive v3 via REST + URLSession (no GTLR), tokens in Keychain, MIME + modified date for cache busting.


2) Tag chips: clearer states, fewer clicks

Why it’s calmer: you see exactly what’s filtering, and you can isolate a single tag without hunting in a sidebar.


3) List ↔ Grid: faster and steady


Tiny wins that matter


Try it

  1. Toggle list↔grid in Resources; notice no header jump.
  2. Tap a couple of tags, then isolate one with Option/Alt.
  3. Open a large image folder—the first row should render fast with clean fallbacks.

What’s next


Internal & External Links


Update / Version Box

LifeOS — Dev Log #3


Signature

— Rev. Brian Scott O’Keefe
“Less friction, more flow.”

Tokens, Sync, Clean Start

Current goals

Auth & tokens (the new backbone)

The old way was tangled. The new way is simple:

What I broke today:
A silent refresh loop when the network dropped mid-refresh. Fixed by gating concurrent refresh calls and memoizing the in-flight promise so only one refresh can run at a time.

Privacy posture: tokens never leave the device; logs redact headers; no crash reports include PII.

File view ideas (don’t fight the brain)

I’m designing for calm and orientation:

Sketch note: the content column aligns to a golden-ratio container; actions hide until hover/focus to reduce visual noise.

Known bugs (current reality, not vibes)

I’m keeping these here until each is closed and regression-tested.

Next sprint (tight, testable, shippable)

1) Auth polish

2) File view MVP

3) Sync + cache

4) Quality gates

CTA: Tell me your top pain in organizing files; I’ll test it in the next build.
Drop a comment or reply with a 1–2 sentence description (bonus: a quick phone snapshot of your folder chaos). Real pain > hypothetical features.

Changelog (human-sized)

- randomblink

Am no an listening depending up believing. Enough around remove to barton agreed regret in or it. Advantage mr estimable.
me@randomblink.com
© Copyright 2025 - Red Pixels Agency - All Rights Reserved
...
...
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram