<?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>DEV Community: Ying Tunyaporn</title>
    <description>The latest articles on DEV Community by Ying Tunyaporn (@tunyaporn_sub_a4c79).</description>
    <link>https://dev.to/tunyaporn_sub_a4c79</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%2F3336770%2Fd0bb20ba-cb7d-48fe-9a0d-e5f40769ba83.jpg</url>
      <title>DEV Community: Ying Tunyaporn</title>
      <link>https://dev.to/tunyaporn_sub_a4c79</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tunyaporn_sub_a4c79"/>
    <language>en</language>
    <item>
      <title>Understanding OAuth2: A Beginner-Friendly Guide</title>
      <dc:creator>Ying Tunyaporn</dc:creator>
      <pubDate>Sun, 03 Aug 2025 16:46:36 +0000</pubDate>
      <link>https://dev.to/tunyaporn_sub_a4c79/understanding-oauth2-a-beginner-friendly-guide-3e4o</link>
      <guid>https://dev.to/tunyaporn_sub_a4c79/understanding-oauth2-a-beginner-friendly-guide-3e4o</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;I had heard about OAuth2 many times, but I never really understood what it was, since I had never worked on implementing authentication and authorization myself.&lt;br&gt;
If you are in the same boat, this post is for you!&lt;/p&gt;

&lt;p&gt;Before we jump into OAuth2, let's review some basic terminology you should know:&lt;/p&gt;

&lt;h4&gt;
  
  
  Authentication
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;is the step that you verify the identity of the user.&lt;/li&gt;
&lt;li&gt;verifying &lt;strong&gt;who you are&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Authorization
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;is the step that you verify the permission of the user.&lt;/li&gt;
&lt;li&gt;verifying &lt;strong&gt;what you're allowed to do&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What is OAuth2?
&lt;/h2&gt;

&lt;p&gt;OAuth2 is a security standard that allows one application to access user data from another application on the user's behalf &lt;strong&gt;without needing the user's password&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For example, when you log into a website using your Google account, OAuth2 allows that website to access your data without seeing your password.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Many organizations provide authorization servers that follow the OAuth2 framework, such as Okta, Keycloak, Auth0, and AWS Cognito.&lt;/p&gt;

&lt;p&gt;The main terminologies in OAuth2&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Resource Owner&lt;/strong&gt; is the end user who owns the data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt; is the application that wants to access data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Authorization Server&lt;/strong&gt; is the server that knows about resource owners, handles the login process, and issues tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Server&lt;/strong&gt; is the data provider that hosts the protected data.&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  Common Grant Types
&lt;/h3&gt;

&lt;p&gt;Each grant type is for different use cases&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Authorization Code
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;📌 Use case&lt;/strong&gt;&lt;br&gt;
When an &lt;strong&gt;end user is involved&lt;/strong&gt;, and the client is a trusted backend server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 How it works&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After the user authorizes, the client receives an &lt;strong&gt;authorization code&lt;/strong&gt; from the authorization server.&lt;/li&gt;
&lt;li&gt;The client sends &lt;strong&gt;authorization code&lt;/strong&gt; with the &lt;strong&gt;client secret&lt;/strong&gt; for an access token.&lt;/li&gt;
&lt;li&gt;The authorization server issues the &lt;strong&gt;access token&lt;/strong&gt; if valid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5gkdgta0detmz7kbjm0u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5gkdgta0detmz7kbjm0u.jpg" alt="OAuth2 Authorization Code diagram" width="800" height="552"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📝 Note:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client in this diagram represents both the frontend and backend together. In practice, the frontend handles redirecting the user to the provider, while the backend exchanges the code for tokens.&lt;/li&gt;
&lt;li&gt;The client must be registered with the authorization server before it can request tokens and access protected resources.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  2. PKCE
&lt;/h4&gt;

&lt;p&gt;PKCE = Proof key for code exchange&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Highlight&lt;/strong&gt;&lt;br&gt;
very similar to the authorization code, but no client secret is involved&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Use case&lt;/strong&gt;&lt;br&gt;
When an &lt;strong&gt;end user is involved&lt;/strong&gt;, but the client &lt;strong&gt;cannot safely store a client secret&lt;/strong&gt;, such as a JavaScript application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 How it works&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client generates a &lt;strong&gt;code verifier&lt;/strong&gt; and &lt;strong&gt;code challenge&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;code challenge&lt;/strong&gt; is sent in the initial authorization request.&lt;/li&gt;
&lt;li&gt;After the user authorizes, the client receives an &lt;strong&gt;authorization code&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The client sends the &lt;strong&gt;authorization code&lt;/strong&gt; along with the &lt;strong&gt;code verifier&lt;/strong&gt; for an access token.&lt;/li&gt;
&lt;li&gt;The authorization server checks if the original code challenge matches the newly calculated one using the code verifier and issues the &lt;strong&gt;access token&lt;/strong&gt; if valid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9udg2xg8lqsg57tqmlo3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9udg2xg8lqsg57tqmlo3.jpg" alt="OAuth2 PKCE diagram" width="800" height="578"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  3. Client Credentials
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;📌 Use case&lt;/strong&gt;&lt;br&gt;
When two backend applications communicate with each other, and &lt;strong&gt;an end user is not involved&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 How it works&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client authenticates using client ID and &lt;strong&gt;client secret&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The authorization server returns the &lt;strong&gt;access token&lt;/strong&gt; directly.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  4. Refresh Token
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;📌 Use case&lt;/strong&gt;&lt;br&gt;
When the access token expires, behind the scenes, the client application initiates this flow without involving the end user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 How it works&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client stores a &lt;strong&gt;refresh token&lt;/strong&gt; after the initial login.&lt;/li&gt;
&lt;li&gt;When the &lt;strong&gt;access token&lt;/strong&gt; expires, the client sends the refresh token to get a new one.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Bonus: How the Resource Server Validates Tokens
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Validating remotely
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;The token is in an opaque format (a random string with no readable info)&lt;/li&gt;
&lt;li&gt;The resource server will send the access token to the authorization server to validate by calling the introspection endpoint exposed by the authorization server.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. Validating locally
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;The token is JWT (JSON Web Token) format&lt;/li&gt;
&lt;li&gt;The resource server can verify the token itself.&lt;/li&gt;
&lt;li&gt;The secure approach is to use a JWKS (JSON Web Key Set).

&lt;ul&gt;
&lt;li&gt;The authorization server has a private key to issue the access token&lt;/li&gt;
&lt;li&gt;The resource server uses a public key to validate it.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;OAuth2 is a security standard that helps with authorization between applications.&lt;/li&gt;
&lt;li&gt;It allows applications to access user data without needing the user's password.&lt;/li&gt;
&lt;li&gt;It provides different grant types to support different use cases:

&lt;ul&gt;
&lt;li&gt;When an end user is involved &lt;strong&gt;→ Authorization Code&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;When an end user is involved but the client can’t store a secret &lt;strong&gt;→ PKCE&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;When no end user is involved (server-to-server) &lt;strong&gt;→ Client Credentials&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;When the access token expires &lt;strong&gt;→ Refresh Token&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h3&gt;
  
  
  Reference
&lt;/h3&gt;

&lt;p&gt;I learned a lot from this Udemy course: &lt;a href="https://www.udemy.com/course/spring-security-zero-to-master/" rel="noopener noreferrer"&gt;Spring Security Zero to Master&lt;/a&gt; on Spring Security, including OAuth2, which explained the grant types clearly. &lt;br&gt;
Note: I’m not affiliated with this course — I just found it very helpful!&lt;/p&gt;

</description>
      <category>oauth2</category>
      <category>beginnerdeveloper</category>
      <category>techexplained</category>
    </item>
    <item>
      <title>CSS Art: A Day in the Office</title>
      <dc:creator>Ying Tunyaporn</dc:creator>
      <pubDate>Sun, 27 Jul 2025 17:53:03 +0000</pubDate>
      <link>https://dev.to/tunyaporn_sub_a4c79/css-art-a-day-in-the-office-3e90</link>
      <guid>https://dev.to/tunyaporn_sub_a4c79/css-art-a-day-in-the-office-3e90</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for &lt;a href="https://dev.to/challenges/frontend/axero"&gt;Frontend Challenge: Office Edition sponsored by Axero, CSS Art: Office Culture&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inspiration
&lt;/h2&gt;

&lt;p&gt;I enjoy creating beautiful front-end layouts and simple graphics. I found this challenge exciting because I don’t often get the chance to do this kind of creative work in my full-time job.&lt;/p&gt;

&lt;p&gt;My inspiration comes from my experience at the office. We have hot desks since we don't need to come in every day, a meeting room where we spend hours discussing ideas, and a canteen where we take breaks and grab snacks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Tunyaporn-Subsakorn/embed/XJmjPxv?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;I started by drafting my idea for what my office would look like. &lt;br&gt;
I tried to show how differently we arrange our desks, and show what we do apart from completing our tasks, like meeting with the team, taking a break, and chatting with our colleagues.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I learned
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Used &lt;code&gt;display: grid&lt;/code&gt; to create the office layout.&lt;/li&gt;
&lt;li&gt;Used the &lt;code&gt;clip-path&lt;/code&gt; property to shape elements.&lt;/li&gt;
&lt;li&gt;Used &lt;code&gt;position: relative&lt;/code&gt; and &lt;code&gt;position: absolute&lt;/code&gt; to place components precisely.&lt;/li&gt;
&lt;li&gt;Used &lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt; to add elements on top of the main element.&lt;/li&gt;
&lt;li&gt;Used the &lt;code&gt;animation&lt;/code&gt; property to animate elements.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thank you for this challenge 🌷&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq17s11iax99bjq5acji2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq17s11iax99bjq5acji2.jpg" alt="Screeenshot Demo Image"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>frontendchallenge</category>
      <category>devchallenge</category>
      <category>css</category>
    </item>
  </channel>
</rss>
