# Secure Google + LinkedIn OAuth flow for WeWeb + Xano

**URL:** <https://community.weweb.io/t/secure-google-linkedin-oauth-flow-for-weweb-xano/21673>\
**Category:** Tutorials\
**Tags:** authentication, google\
**Created:** [October 2, 2026, 11:16am UTC](https://community.weweb.io/t/secure-google-linkedin-oauth-flow-for-weweb-xano/21673 "2026-10-02T11:16:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Perales](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/perales/32/16781_2.png) [@Perales](https://community.weweb.io/u/Perales)\
**Post date:** [October 2, 2026, 11:16am UTC](https://community.weweb.io/t/secure-google-linkedin-oauth-flow-for-weweb-xano/21673/1 "2026-10-02T11:16:52Z")

</div>

I put together a small open-source reference implementation for handling Google and LinkedIn OAuth securely with WeWeb + Xano.

The frontend side is plain JavaScript that can be used inside WeWeb workflows, and it handles:

- generating a 256-bit nonce in the browser
- storing it in `sessionStorage`
- sending the nonce to Xano before redirecting to Google or LinkedIn
- reading `code` and `state` on the callback page
- removing the nonce before the backend call
- cleaning `code` and `state` from the URL
- handling cancel, reload, missing nonce and invalid callback cases

On the Xano side, the flow adds:

- signed OAuth `state`
- provider binding
- 10-minute expiry
- nonce hashing
- verification before the authorization code is exchanged

I tested the full flow end to end against both Google and LinkedIn, including wrong nonce, tampered state, missing state/nonce, cross-provider state, expired state and replayed authorization codes.

The repo includes:

- frontend JS examples for Google and LinkedIn
- Xano functions and endpoints
- setup instructions
- architecture diagrams
- threat model
- runtime test cases

GitHub:

> **[GitHub - jperaleselizondo-hash/secure-xano-oauth](https://github.com/jperaleselizondo-hash/secure-xano-oauth)**
>
> Contribute to jperaleselizondo-hash/secure-xano-oauth development by creating an account on GitHub.

It’s intended as a reference implementation rather than an official WeWeb or Xano solution. If anyone is building custom OAuth flows with WeWeb, I’d be interested in feedback or edge cases I may have missed.

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [October 2, 2026, 12:16pm UTC](https://community.weweb.io/t/secure-google-linkedin-oauth-flow-for-weweb-xano/21673/2 "2026-10-02T12:16:41Z")

</div>

Very cool! Thanks for putting this together and sharing it with the community 🙂

---

<div class="post-metadata">

**Author:** ![ryanwhitaker](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/ryanwhitaker/32/16812_2.png) [@ryanwhitaker](https://community.weweb.io/u/ryanwhitaker)\
**Post date:** [October 14, 2026, 2:15pm UTC](https://community.weweb.io/t/secure-google-linkedin-oauth-flow-for-weweb-xano/21673/3 "2026-10-14T14:15:36Z")

</div>

Nice write-up, the nonce in sessionStorage plus cleaning `code` and `state` from the URL covers the usual mistakes.

Two additions that might be worth including in the reference: since the flow starts in the browser, adding PKCE (a `code_verifier` kept client-side and the `code_challenge` sent on the authorize request) protects against an intercepted authorization code. And on the Xano side, treating the nonce as single-use with a short expiry, plus checking the ID token’s `aud`, `iss` and `exp` for Google, closes off replay of an old callback.
