<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Fung</title>
    <description>The latest articles on Forem by Fung (@fung-authgear).</description>
    <link>https://forem.com/fung-authgear</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1928554%2F7513911f-ea47-482f-91d5-9d2290dcfdb4.jpeg</url>
      <title>Forem: Fung</title>
      <link>https://forem.com/fung-authgear</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/fung-authgear"/>
    <language>en</language>
    <item>
      <title>Testing HMAC Signatures Online — A Free Developer Tool</title>
      <dc:creator>Fung</dc:creator>
      <pubDate>Wed, 08 Oct 2025 16:21:39 +0000</pubDate>
      <link>https://forem.com/authgear/testing-hmac-signatures-online-a-free-developer-tool-51mk</link>
      <guid>https://forem.com/authgear/testing-hmac-signatures-online-a-free-developer-tool-51mk</guid>
      <description>&lt;p&gt;APIs often rely on HMAC signatures to verify the authenticity and integrity of requests.&lt;br&gt;
Whether you’re validating webhooks, securing IoT messages, or signing API payloads, it’s crucial to confirm that your HMAC implementation works correctly — and that both client and server generate the same signature.&lt;/p&gt;

&lt;p&gt;That’s where a free testing tool helps.&lt;/p&gt;
&lt;h2&gt;
  
  
  🔐 What Is an HMAC Signature?
&lt;/h2&gt;

&lt;p&gt;An &lt;em&gt;HMAC (Hash-based Message Authentication Code)&lt;/em&gt; is a unique signature generated by hashing a message with a secret key.&lt;br&gt;
If the message changes or the key is incorrect, the signature won’t match — protecting your API from tampering or replay attacks.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HMAC = hash(secret_key + message)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Common algorithms: &lt;code&gt;SHA-256&lt;/code&gt;, &lt;code&gt;SHA-1&lt;/code&gt;, &lt;code&gt;SHA-512&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🧮 Why You Need to Test HMAC Signatures
&lt;/h2&gt;

&lt;p&gt;When integrating APIs, mismatched HMAC signatures are among the most common debugging issues.&lt;br&gt;
You might face:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Incorrect encoding (UTF-8 vs ASCII)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mismatched algorithms (SHA1 vs SHA256)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Differences in message formatting&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Missing newline characters or whitespace&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Testing with a live HMAC tool helps quickly isolate these problems before they break production code.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧰 Free Tool: HMAC Signature Generator &amp;amp; Verifier
&lt;/h2&gt;

&lt;p&gt;You can instantly generate or verify HMAC signatures using this free tool:&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://www.authgear.com/tools/hmac-signature-generator-verifier" rel="noopener noreferrer"&gt;HMAC Signature Generator &amp;amp; Verifier — by Authgear&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supports SHA-1, SHA-256, and SHA-512
&lt;/li&gt;
&lt;li&gt;“Generate” or “Verify” modes
&lt;/li&gt;
&lt;li&gt;Copy-to-clipboard output
&lt;/li&gt;
&lt;li&gt;Real-time hash calculation
&lt;/li&gt;
&lt;li&gt;No account or API key required
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to Use It:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paste your message.
&lt;/li&gt;
&lt;li&gt;Enter your secret key.
&lt;/li&gt;
&lt;li&gt;Choose the hash algorithm (e.g., SHA-256).
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Generate&lt;/strong&gt; to get your signature — or switch to &lt;strong&gt;Verify&lt;/strong&gt; mode to compare an existing one.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It’s a simple way to confirm that your backend code is producing the same HMAC value you expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧑‍💻 Quick Example in Node.js
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;crypto&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello from Authgear&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mysecretkey&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHmac&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sha256&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;hex&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Generated HMAC:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can paste your message and secret into the &lt;a href="https://www.authgear.com/tools/hmac-signature-generator-verifier" rel="noopener noreferrer"&gt;Authgear HMAC tool&lt;/a&gt; to verify the result instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  🌐 Why Developers Use HMAC
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Lightweight and fast&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Works offline (no tokens or external verification)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easy to implement in any language&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Still one of the most secure message verification methods in 2025&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>api</category>
      <category>security</category>
      <category>authgear</category>
      <category>developers</category>
    </item>
    <item>
      <title>JWE vs JWT — Side-by-Side for Developers</title>
      <dc:creator>Fung</dc:creator>
      <pubDate>Fri, 15 Aug 2025 08:30:00 +0000</pubDate>
      <link>https://forem.com/fung-authgear/jwe-vs-jwt-side-by-side-for-developers-4lm</link>
      <guid>https://forem.com/fung-authgear/jwe-vs-jwt-side-by-side-for-developers-4lm</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;JWT&lt;/strong&gt; = signed, readable payload (integrity).&lt;br&gt;&lt;br&gt;
&lt;strong&gt;JWE&lt;/strong&gt; = encrypted, hidden payload (integrity + confidentiality).&lt;/p&gt;

&lt;p&gt;This is a quick, practical breakdown with examples and a comparison table you can skim in under 3 minutes.&lt;/p&gt;


&lt;h2&gt;
  
  
  JWT (JSON Web Token) in a nutshell
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Structure: &lt;code&gt;header.payload.signature&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signed&lt;/strong&gt; to prevent tampering, but &lt;strong&gt;not encrypted&lt;/strong&gt; — anyone with the token can read the payload.
&lt;/li&gt;
&lt;li&gt;Great for auth claims, sessions, API access control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example (shortened):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  JWE (JSON Web Encryption) in a nutshell
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Structure: &lt;code&gt;protectedHeader.encryptedKey.iv.ciphertext.tag&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Encrypted&lt;/strong&gt; — only intended recipients can read the payload.
&lt;/li&gt;
&lt;li&gt;Great for transmitting sensitive data (PII, financial info, secrets).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example (shortened):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eyJhbGciOiJSU...encryptedKey...iv...ciphertext...tag
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  JWE vs JWT — Quick Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;JWT&lt;/th&gt;
&lt;th&gt;JWE&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Data Protection&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Signed only – payload visible&lt;/td&gt;
&lt;td&gt;Encrypted – payload hidden&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary Use&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Authentication &amp;amp; claims verification&lt;/td&gt;
&lt;td&gt;Secure data transmission&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Faster, smaller size&lt;/td&gt;
&lt;td&gt;Slower, larger size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Visibility&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Anyone can read payload&lt;/td&gt;
&lt;td&gt;Only recipients can decrypt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Complexity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Easier to implement&lt;/td&gt;
&lt;td&gt;More complex setup&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Security Level&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Protects integrity&lt;/td&gt;
&lt;td&gt;Protects integrity &lt;strong&gt;and&lt;/strong&gt; confidentiality&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  When to use which
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Choose JWT&lt;/strong&gt; when you only need integrity (no tampering) and payload visibility is acceptable.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose JWE&lt;/strong&gt; when you also need confidentiality — the payload must remain private.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Bonus: structures at a glance
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;JWT parts:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Header: &lt;code&gt;alg&lt;/code&gt;, &lt;code&gt;kid&lt;/code&gt;, &lt;code&gt;typ&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Payload: claims
&lt;/li&gt;
&lt;li&gt;Signature: verifies integrity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;JWE parts:&lt;/strong&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protected Header: &lt;code&gt;alg&lt;/code&gt;, &lt;code&gt;enc&lt;/code&gt;, &lt;code&gt;kid&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Encrypted Key: content-encryption key for recipient
&lt;/li&gt;
&lt;li&gt;IV: initialization vector
&lt;/li&gt;
&lt;li&gt;Ciphertext: encrypted payload
&lt;/li&gt;
&lt;li&gt;Tag: authentication tag&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Tools for working with tokens
&lt;/h2&gt;

&lt;p&gt;Need to generate keys or convert PEM → JWK for testing JWT/JWE?&lt;br&gt;&lt;br&gt;
Try this &lt;a href="https://www.authgear.com/tools/jwk-generator" rel="noopener noreferrer"&gt;&lt;strong&gt;JWK Generator&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Read the full guide
&lt;/h2&gt;

&lt;p&gt;For deeper explanations, examples, and best practices, read the original post on Authgear:&lt;br&gt;&lt;br&gt;
&lt;a href="https://www.authgear.com/post/jwe-vs-jwt" rel="noopener noreferrer"&gt;https://www.authgear.com/post/jwe-vs-jwt&lt;/a&gt;&lt;/p&gt;

</description>
      <category>jwt</category>
      <category>jwe</category>
      <category>security</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What is JWKS? JSON Web Key Set — Short Guide</title>
      <dc:creator>Fung</dc:creator>
      <pubDate>Thu, 14 Aug 2025 13:16:54 +0000</pubDate>
      <link>https://forem.com/fung-authgear/what-is-jwks-json-web-key-set-short-guide-3j9m</link>
      <guid>https://forem.com/fung-authgear/what-is-jwks-json-web-key-set-short-guide-3j9m</guid>
      <description>&lt;p&gt;If you work with JWTs, OAuth, or any token-based authentication, you’ve probably seen the term &lt;strong&gt;JWKS&lt;/strong&gt;. So — what is &lt;strong&gt;JWKS&lt;/strong&gt; and why does it matter? In short: a &lt;strong&gt;JWKS (JSON Web Key Set)&lt;/strong&gt; is a standardized JSON document that publishes one or more public keys (JWKs) so clients and APIs can verify signatures or perform encryption. This guide explains JWKS in plain language, shows the &lt;strong&gt;JWK format&lt;/strong&gt; with examples, covers the jwks uri pattern, and gives practical tips for creating and managing JWKS in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding JSON Web Keys (JWK) and JWKS
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;JSON Web Key (JWK)&lt;/strong&gt; is a JSON object that represents a cryptographic key — for example, an RSA public key or an EC key. Key fields include &lt;code&gt;kty&lt;/code&gt; (key type), &lt;code&gt;kid&lt;/code&gt; (key id), &lt;code&gt;use&lt;/code&gt; (intended use), &lt;code&gt;alg&lt;/code&gt; (algorithm), and key material fields like &lt;code&gt;n&lt;/code&gt;/&lt;code&gt;e&lt;/code&gt; for RSA or &lt;code&gt;x&lt;/code&gt;/&lt;code&gt;y&lt;/code&gt; for EC.&lt;/p&gt;

&lt;p&gt;A JWKS is simply a JSON object with a keys array that bundles multiple JWKs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keys"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"kty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"RSA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"kid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2023-01-key-1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"use"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sig"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"alg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"RS256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"n"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; 
      &lt;/span&gt;&lt;span class="nl"&gt;"e"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AQAB"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why this matters: services that issue tokens publish a JWKS so other services (APIs, clients) can automatically fetch the public keys they need to verify token signatures or encrypt payloads. The JWKS standard makes this machine-readable and interoperable across libraries.&lt;/p&gt;

&lt;h2&gt;
  
  
  How JWKS Works in Authentication &amp;amp; APIs
&lt;/h2&gt;

&lt;p&gt;Typical flow in an API ecosystem:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Issuer publishes a JWKS at a stable URL (the &lt;code&gt;jwks_uri&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Clients or resource servers fetch the JWKS and cache it.&lt;/li&gt;
&lt;li&gt;When a JWT arrives, the kid in the token header identifies which JWK to use.&lt;/li&gt;
&lt;li&gt;The client finds the matching JWK inside the JWKS and uses it to verify the token signature or perform encryption-related steps.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This pattern decouples key rotation from deployments: when you roll keys, you update the JWKS; consuming services pick up updated public keys without redeploying code. For JWEs (encrypted tokens), the JWKS can provide public keys for encryption as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  JWKS URI: How to Find and Use It
&lt;/h2&gt;

&lt;p&gt;Many identity providers expose a discovery document — often at &lt;code&gt;/.well-known/openid-configuration&lt;/code&gt; — which contains a &lt;code&gt;jwks_uri&lt;/code&gt; field that points to the JWKS location:‍&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"issuer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://idp.example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"jwks_uri"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://idp.example.com/.well-known/jwks.json"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;‍How to use the &lt;code&gt;jwks_uri&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure your OIDC/OAuth client library to read the discovery document or directly point it to the &lt;code&gt;jwks_uri&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Libraries will fetch and cache the JWKS, matching the &lt;code&gt;kid&lt;/code&gt; in incoming JWTs to the correct JWK.&lt;/li&gt;
&lt;li&gt;Implement a refresh strategy (e.g., periodic refresh or refresh on verification failures) so your service handles key rotation smoothly.&lt;/li&gt;
&lt;li&gt;Tip: Always serve JWKS over HTTPS and include stable kid values for easier rotation handling.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  JWK Format Explained (with Example)
&lt;/h2&gt;

&lt;p&gt;A JWK contains a standardized set of fields. Here’s a more complete RSA public key example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"kty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"RSA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"kid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2011-04-29"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"use"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sig"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"alg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"RS256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"n"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"oahUI...base64url-modulus..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"e"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AQAB"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Field breakdown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;kty&lt;/code&gt; — key type (e.g., RSA, EC, oct)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kid&lt;/code&gt; — key ID used to select keys in a JWKS&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;use&lt;/code&gt; — intended use: sig for signature verification, enc for encryption&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;alg&lt;/code&gt; — algorithm (e.g., RS256, ES256)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;n&lt;/code&gt;, &lt;code&gt;e&lt;/code&gt; (RSA) or &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;crv&lt;/code&gt; (EC) — the key material in base64url form&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full JWKS example with two keys:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"keys"&lt;/span&gt;&lt;span class="p"&gt;:[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"kty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"RSA"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"kid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"rsa1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"use"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"sig"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"alg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"RS256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"n"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"e"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"AQAB"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"kty"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"EC"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"kid"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"ec1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"use"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"enc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"alg"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"ECDH-ES"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"crv"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"P-256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"x"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"y"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"..."&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Including &lt;code&gt;use&lt;/code&gt; and &lt;code&gt;alg&lt;/code&gt; fields helps clients quickly determine whether a key is suitable for signature verification or encryption.&lt;/p&gt;

&lt;h2&gt;
  
  
  PEM and converting to JWK
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;PEM (Privacy-Enhanced Mail)&lt;/strong&gt; is a very common format for storing keys and certificates. It’s base64-encoded DER data wrapped in human-readable header/footer lines such as &lt;code&gt;-----BEGIN PUBLIC KEY-----&lt;/code&gt; and &lt;code&gt;-----END PUBLIC KEY-----&lt;/code&gt;. You’ll often see PEM files with extensions like .pem, .crt, or .key.&lt;/p&gt;

&lt;p&gt;If you need to use a PEM key with a JWKS workflow, the usual step is to extract the public key from the PEM and convert that public key into a JWK. For RSA keys you can extract the public PEM like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl rsa &lt;span class="nt"&gt;-in&lt;/span&gt; private.pem &lt;span class="nt"&gt;-pubout&lt;/span&gt; &lt;span class="nt"&gt;-out&lt;/span&gt; public.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For EC keys, the extraction looks similar:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl ec &lt;span class="nt"&gt;-in&lt;/span&gt; key.pem &lt;span class="nt"&gt;-pubout&lt;/span&gt; &lt;span class="nt"&gt;-out&lt;/span&gt; public.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you have the public PEM, convert it to a JWK using a JOSE library (&lt;code&gt;node-jose&lt;/code&gt;, &lt;code&gt;python-jose&lt;/code&gt;, etc.) or a conversion tool. The conversion produces the JWK fields your JWKS needs — for example kty, n/e (RSA) or x/y/crv (EC).&lt;/p&gt;

&lt;p&gt;If you want a quick, UI-driven option, the Authgear &lt;a href="https://www.authgear.com/tools/jwk-generator" rel="noopener noreferrer"&gt;JWK Generator&lt;/a&gt; can convert PEM public keys into correctly formatted JWK objects (RSA/EC) so you can drop them straight into your JWKS.&lt;/p&gt;

&lt;p&gt;Security note: never publish private PEM material in a JWKS. Only include public key material, always serve your JWKS over HTTPS, and follow a safe key-rotation strategy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating and Managing JWKS for Your Application
&lt;/h2&gt;

&lt;p&gt;Generating keys: You can create JWKs with various libraries (node-jose, python-jose, OpenSSL + converters) or use a purpose-built tool. If you want a quick, standards-compliant way to create JWKs or convert existing PEM keys into JWK format, try the Authgear &lt;a href="https://www.authgear.com/tools/jwk-generator" rel="noopener noreferrer"&gt;JWK Generator&lt;/a&gt; — it outputs RSA/EC key pairs and can convert PEM public keys into JWK format, ready for development and testing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Publishing a JWKS:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Host the JWKS JSON at a stable HTTPS endpoint (e.g., &lt;code&gt;https://auth.example.com/.well-known/jwks.json&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Only include public key material; never publish private keys.&lt;/li&gt;
&lt;li&gt;Assign &lt;code&gt;kid&lt;/code&gt; values and add new keys before rotating old ones.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Rotation strategy:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Generate new key pair and add the public JWK to the JWKS with a new kid.&lt;/li&gt;
&lt;li&gt;Update the issuer to sign tokens with the new private key.&lt;/li&gt;
&lt;li&gt;Keep the old public JWK in the JWKS for a grace period to allow clients to validate existing tokens.&lt;/li&gt;
&lt;li&gt;Remove the old JWK once tokens signed with it are expired.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Security best practices:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Serve JWKS over HTTPS.&lt;/li&gt;
&lt;li&gt;Cache the JWKS but refresh on verification errors.&lt;/li&gt;
&lt;li&gt;Limit JWKS to only the keys you actively use.&lt;/li&gt;
&lt;li&gt;Monitor for failed verifications that might signal a missing or rotated key.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common Questions About JWKS (FAQ)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is JWKS used for?
&lt;/h3&gt;

&lt;p&gt;JWKS is used to publish public keys that clients and APIs can fetch to verify JWT signatures or obtain public keys for encryption workflows — enabling dynamic, interoperable key distribution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is a JWKS file public or private?
&lt;/h3&gt;

&lt;p&gt;A JWKS is typically public — it contains public keys only. Private keys must stay secure on the issuer’s side and should never be included.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I generate a JWK?
&lt;/h3&gt;

&lt;p&gt;You can generate JWKs via libraries (OpenSSL → convert to JWK, or use JOSE libraries) or use a generator tool like Authgear’s &lt;a href="https://www.authgear.com/tools/jwk-generator" rel="noopener noreferrer"&gt;JWK Generator&lt;/a&gt; to quickly produce JWK-formatted keys for testing or staging.&lt;/p&gt;

&lt;h2&gt;
  
  
  Relationship to JWT and JWE
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;JWT (signed tokens)&lt;/strong&gt;: JWTs include a kid in the header that points to a JWK in a JWKS so recipients can verify signatures using the corresponding public key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JWE (encrypted tokens)&lt;/strong&gt;: JWKS can also publish public keys used to encrypt payloads or derive shared keys for decryption on the recipient side.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You don’t need deep knowledge of JWT/JWE to use JWKS — just remember JWKS is the standard way to distribute public keys that make JWT signature verification and JWE encryption interoperable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A JWKS (JSON Web Key Set) is a small but crucial piece of modern token-based security: it standardizes how public keys (JWKs) are published and fetched via a jwks_uri, enabling seamless verification and encryption across services. Use correct JWK format, host your JWKS securely, implement a rotation strategy, and consider using tools like the Authgear &lt;a href="https://www.authgear.com/tools/jwk-generator" rel="noopener noreferrer"&gt;JWK Generator&lt;/a&gt; to speed up development, convert PEM public keys, and simplify testing.&lt;/p&gt;




&lt;p&gt;For the full guide with extended examples, code snippets, and best practices, read the canonical article on Authgear:&lt;br&gt;
&lt;a href="https://www.authgear.com/post/what-is-jwks" rel="noopener noreferrer"&gt;https://www.authgear.com/post/what-is-jwks&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>jwk</category>
      <category>jwt</category>
      <category>oauth</category>
    </item>
    <item>
      <title>SSO Simplified: Enhancing Security and User Experience</title>
      <dc:creator>Fung</dc:creator>
      <pubDate>Mon, 02 Sep 2024 05:27:52 +0000</pubDate>
      <link>https://forem.com/authgear/sso-simplified-enhancing-security-and-user-experience-43fe</link>
      <guid>https://forem.com/authgear/sso-simplified-enhancing-security-and-user-experience-43fe</guid>
      <description>&lt;p&gt;Single Sign-On (SSO) has become a cornerstone of modern digital authentication strategies. In essence, SSO allows users to access multiple applications and services with a single set of credentials, streamlining the user experience and enhancing security. For IT managers and technicians, implementing SSO effectively can significantly reduce password fatigue, minimize security risks, and improve overall productivity.&lt;/p&gt;

&lt;p&gt;This handbook article aims to provide a deep dive into SSO technologies, exploring various implementation scenarios, underlying mechanisms, and best practices. By the end of this guide, you'll be equipped with the knowledge to make informed decisions about SSO deployment in your organization.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Scenarios Where SSO is Needed
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1.1 Multi-app Ecosystem
&lt;/h2&gt;

&lt;p&gt;Large tech companies often operate diverse portfolios of applications and services. SSO plays a crucial role in unifying these ecosystems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Meta:&lt;/strong&gt; Facebook, Instagram, Messenger, and Threads form a tightly integrated social media ecosystem. Users can seamlessly switch between these platforms without re-authenticating, enhancing engagement and cross-platform interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google:&lt;/strong&gt; The suite including Google Photos, Drive, Maps, and Home devices showcases how SSO can span both web and IoT environments. A single Google account provides access to a vast array of services, from productivity tools to smart home controls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uber:&lt;/strong&gt; By unifying Uber ride-hailing, UberEats food delivery, and the Uber Drivers app under a single authentication system, the company provides a cohesive experience for both customers and service providers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In these ecosystems, SSO not only enhances user experience but also allows for more effective data sharing and personalization across services, while maintaining robust security protocols, even if the apps were all built by completely different teams.&lt;/p&gt;

&lt;h2&gt;
  
  
  1.2 Spin-off Apps and Campaigns
&lt;/h2&gt;

&lt;p&gt;Enterprises frequently launch new initiatives that require rapid development and deployment. This often includes spin-off projects, and prototype testing of new product concepts. In such cases, Single Sign-On (SSO) can be a crucial tool.&lt;/p&gt;

&lt;p&gt;For marketing campaigns requiring quick web apps, SSO allows these temporary applications to securely use existing user bases. SSO also streamlines user onboarding for new ventures by tapping into the parent company’s user pool and facilitates prototype testing with a subset of existing users without creating new authentication systems.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gws0go6ninbnw934bay.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gws0go6ninbnw934bay.jpg" alt="SSO vs no-SSO" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes, the development team of the core app may be too busy to respond quickly to requests for new initiatives, such as a web app for a marketing campaign. Having an SSO infrastructure in place can empower a small development and design team to iterate rapidly.&lt;/p&gt;

&lt;p&gt;By implementing SSO, organizations can maintain agility in launching new initiatives while ensuring that user data remains protected and consistent across all touchpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  1.3 Super Apps with Mini Programs
&lt;/h2&gt;

&lt;p&gt;The concept of super apps, popularized in Asian markets, is gaining traction globally, with some popular examples including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LINE/KakaoTalk:&lt;/strong&gt; These super apps incorporate messaging, social media, and a vast ecosystem of mini-programs, all accessible through a single login.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gojek:&lt;/strong&gt; In Southeast Asia, Gojek offers ride-hailing, food delivery, news, and financial services within a single app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Super apps can also be found within enterprise environments, where they offer significant advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Corporate Portals:&lt;/strong&gt; Instead of asking staff to install multiple different apps, an enterprise may package various internal tools into a single mobile app. This super app can include systems like HR, inventory management, and communication platforms, all built by different developers or business units.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Field Service Apps:&lt;/strong&gt; Companies with mobile workforces, such as maintenance or IT, can bundle multiple tools (scheduling, invoicing, knowledge bases) into one app with SSO. This approach provides employees with seamless access to all necessary resources in one place.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In both cases, services must be accessible on mobile platforms and web browsers. Delivering these services as web apps is cost-effective and ensures they are always up-to-date. However, implementing SSO in super apps presents unique challenges, particularly in managing session states across different mini-programs or web views.&lt;/p&gt;

&lt;p&gt;A secure SSO mechanism helps manage sessions across the app suite, allowing for smooth transitions between services while maintaining strict security boundaries. IT professionals must ensure seamless integration between various services to provide an efficient user experience and uphold high security standards.&lt;/p&gt;

&lt;h2&gt;
  
  
  1.4 App-to-App Authentication
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3i83vpsn9e7d4siuwea.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3i83vpsn9e7d4siuwea.gif" alt="App2app Example" width="1600" height="900"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;App-to-app (app2app) authentication is becoming increasingly important in mobile ecosystems, as it offers a simpler and faster flow for authentication when the user has already installed and logged into another recognized app on their mobile device. Here are some key use cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Financial Services:&lt;/strong&gt; Banking apps can authorize fintech apps to access account information, streamlining processes like budgeting or investment management. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This integration allows users to seamlessly manage their finances across multiple platforms within a single application.&lt;/p&gt;

&lt;p&gt;Implementing app2app authentication requires careful consideration of security protocols, user consent mechanisms, and data sharing policies. IT managers must ensure compliance with regulations like GDPR or PSD2 when implementing these solutions.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. How Sessions are Shared Between Services
&lt;/h1&gt;

&lt;h2&gt;
  
  
  2.1 Cookies
&lt;/h2&gt;

&lt;p&gt;Cookie-based SSO is one of the most straightforward and essential methods for authenticating users in web applications. It offers several advantages such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Domain-Level Sharing:&lt;/strong&gt; By configuring cookies at the root domain level &lt;em&gt;(e.g., .example.com)&lt;/em&gt;, all subdomains can access the same session information, making it easier to manage user sessions across multiple subdomains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure and HttpOnly Flags:&lt;/strong&gt; These flags enhance security by restricting client-side access to cookies and ensuring that they are only transmitted over secure channels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SameSite Attribute:&lt;/strong&gt; This attribute helps mitigate cross-site request forgery (CSRF) attacks by controlling how cookies are included with cross-site requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2.2 Redirect Flow
&lt;/h2&gt;

&lt;p&gt;You tap &lt;em&gt;"Login"&lt;/em&gt; in an app, and it whisks you away to a familiar login page in your browser. After entering your credentials, you're seamlessly transported back to the app, now fully logged in. This smooth back-and-forth dance is known as the &lt;em&gt;"redirect flow"&lt;/em&gt; - a typical implementation of Single Sign-On (SSO) technology.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmeo1af58x8qybzwl6csl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmeo1af58x8qybzwl6csl.jpg" alt="Redirect Flow" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This seamless experience extends across multiple apps. When a new app redirects you to the same login page, you'll often find your session is still active. With just a quick &lt;em&gt;"Continue"&lt;/em&gt; tap, you're in - no need to re-enter your credentials. &lt;/p&gt;

&lt;p&gt;The redirect flow is crucial for implementing SSO in cross-platform applications and requires secure token exchange mechanisms such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OAuth 2.0 and OpenID Connect:&lt;/strong&gt; These protocols standardize the authorization and authentication processes, allowing for secure token exchange.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Parameter:&lt;/strong&gt; This prevents CSRF attacks by ensuring the request's integrity throughout the redirect process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PKCE (Proof Key for Code Exchange):&lt;/strong&gt; An additional security layer for mobile and single-page applications to prevent interception of the authorization code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here’s an example flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;User&lt;/strong&gt; clicks &lt;em&gt;"Login"&lt;/em&gt; in App A&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App A&lt;/strong&gt; redirects to centralized auth server with &lt;code&gt;client_id&lt;/code&gt; and &lt;code&gt;redirect_uri&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User&lt;/strong&gt; authenticates on auth server&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auth server&lt;/strong&gt; redirects back to App A with an authorization code&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App A&lt;/strong&gt; exchanges code for access and refresh tokens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;App A&lt;/strong&gt; can now make authenticated API calls&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Implementing this flow requires careful coordination between the client application, authorization server, and resource server to ensure secure token handling and validation.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.3 Shared Container
&lt;/h2&gt;

&lt;p&gt;Imagine this: You download the new shiny app Google just released, and it instantly opens to your personalized dashboard without asking you to log in or provide details. No email entry, no password prompt — just immediate access. &lt;em&gt;Real-life magic.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is where shared containers come in.&lt;/p&gt;

&lt;p&gt;Shared containers provide a native SSO experience on mobile platforms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;iOS Keychain and App Groups:&lt;/strong&gt; Allow secure sharing of credentials between apps from the same developer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Android AccountManager:&lt;/strong&gt; Provides a centralized registry of user credentials that can be securely accessed by authorized apps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This example demonstrates how to securely store and retrieve authentication tokens using the iOS Keychain, which can be shared between apps from the same developer.&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Choosing the Right SSO Approach
&lt;/h1&gt;

&lt;p&gt;Selecting the appropriate SSO method depends on various factors:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feqd1br6qht4s9xkzhz89.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feqd1br6qht4s9xkzhz89.jpg" alt="SSO Decision Flowchart" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Platform Diversity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web-only:&lt;/strong&gt; For non-SPA websites, consider &lt;strong&gt;cookie-based solutions&lt;/strong&gt;. For other applications requiring web-specific SSO protocols you can consider using &lt;strong&gt;redirect flow&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixed (Web and Mobile):&lt;/strong&gt; Implement &lt;strong&gt;OAuth 2.0 with OpenID Connect&lt;/strong&gt; for a standardized approach across platforms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mobile-only:&lt;/strong&gt; Utilize platform-specific shared containers or &lt;strong&gt;app2app authentication&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Security Requirements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-security environments may require additional factors like biometrics or hardware tokens.&lt;/li&gt;
&lt;li&gt;Consider implementing FIDO2 standards for passwordless authentication.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User Experience:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Evaluate the trade-off between security and convenience.&lt;/li&gt;
&lt;li&gt;Consider implementing step-up authentication for sensitive operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Regulatory Compliance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure your SSO solution adheres to relevant standards (&lt;em&gt;e.g., GDPR, HIPAA, PSD2&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;Implement appropriate consent and data sharing mechanisms.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose solutions that can grow with your user base and application ecosystem.&lt;/li&gt;
&lt;li&gt;Consider &lt;a href="https://authgear.com/" rel="noopener noreferrer"&gt;cloud-based identity providers&lt;/a&gt; for easier management and scalability.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Taking a thoughtful approach to these considerations will not only enhance security but also streamline access across diverse platforms, ultimately supporting a seamless and efficient user experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Implementing SSO effectively requires a deep understanding of various technologies and careful consideration of your organization's specific needs. By leveraging the right combination of cookies, redirect flows, shared containers, and app2app authentication, you can create a seamless and secure authentication experience across your entire digital ecosystem.&lt;/p&gt;

&lt;p&gt;As you move forward with your SSO implementation, remember to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;u&gt;Regularly audit your authentication systems for security vulnerabilities.&lt;/u&gt;&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Stay informed about emerging authentication standards and best practices.&lt;/u&gt;&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Collect and analyze user feedback to continuously improve the login experience.&lt;/u&gt;&lt;/li&gt;
&lt;li&gt;&lt;u&gt;Plan for future expansion of your application ecosystem and how it will integrate with your SSO solution.&lt;/u&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By following these guidelines and choosing the appropriate SSO methods for your use cases, you can significantly enhance both the security and usability of your organization's digital services.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article is part of a multi-part handbook. If you're interested, follow for more upcoming posts about SSO or join our &lt;a href="https://discord.gg/FRwNvkdkrf" rel="noopener noreferrer"&gt;auth-oriented community&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>sso</category>
      <category>learning</category>
      <category>cybersecurity</category>
      <category>ux</category>
    </item>
  </channel>
</rss>
