<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nitesh Singh on Medium]]></title>
        <description><![CDATA[Stories by Nitesh Singh on Medium]]></description>
        <link>https://medium.com/@nitesh_17214?source=rss-22064e87ff84------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*lfi3mnqB8acxiJQz</url>
            <title>Stories by Nitesh Singh on Medium</title>
            <link>https://medium.com/@nitesh_17214?source=rss-22064e87ff84------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:29:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nitesh_17214/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Future of Identity: OpenID Connect Federation 1.0]]></title>
            <link>https://medium.com/@nitesh_17214/the-future-of-identity-openid-connect-federation-1-0-c5ed937bbd40?source=rss-22064e87ff84------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5ed937bbd40</guid>
            <dc:creator><![CDATA[Nitesh Singh]]></dc:creator>
            <pubDate>Thu, 01 May 2025 08:01:23 GMT</pubDate>
            <atom:updated>2025-05-01T08:01:23.176Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>In today’s identity landscape, federation is essential — but it’s also a mess of static metadata, bilateral agreements, and manual trust setups. <strong>OpenID Connect Federation 1.0 offers a modern, scalable answer.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*scQE4Svw235KEC5h_-gyTw.png" /></figure><h3>Introduction</h3><p><em>Digital identity is everywhere</em> — whether you’re signing into a cloud app, accessing healthcare records, or collaborating across organizations. But behind the scenes, making these logins work smoothly across different domains remains harder than it should be.</p><p>Most federated identity systems today rely on outdated, manual processes. Static metadata, pre-arranged trust agreements, and point-to-point configurations make connecting new providers or scaling across sectors time-consuming. It works — just barely, and certainly not at cloud speed.</p><p>That’s where <strong>OpenID Connect Federation 1.0</strong> comes in. It introduces a smarter, more flexible way to establish trust between identity systems — one that’s dynamic, automated, and built for how the internet works today.</p><blockquote><em>In this article, we’ll go beyond the basics to explore how OpenID Connect Federation 1.0 addresses long-standing challenges in digital identity — from static trust to cross-sector interoperability — and why it’s quickly becoming the new standard for federated identity at scale.</em></blockquote><h3>What’s Wrong with Traditional Federation?</h3><p>Federation isn’t new. For years, organizations have used protocols like <strong>SAML</strong> and <strong>OpenID Connect (OIDC)</strong> to enable cross-domain logins. But establishing trust between systems has always been a pain.</p><p>Most federations today depend on <strong>static metadata</strong> — XML or JSON documents shared manually between parties. Adding a new identity provider (IdP) or relying party (RP) typically requires:</p><ul><li>Manual configuration</li><li>Metadata exchange</li><li>Certificate verification</li><li>Cross-team coordination</li></ul><p>It’s fragile, time-consuming, and doesn’t scale well.</p><p>Worse, trust relationships are typically <strong>point-to-point</strong>. If you’re part of a large network — say, a government or university system — you might manage hundreds of individual trust configurations. One typo in a metadata file can break logins for thousands of users.</p><p>And when certificates expire or endpoints change? You guessed it — more manual work.</p><p>This setup might work for a handful of partners. But if you’re connecting dozens or hundreds of organizations — especially across sectors — it quickly becomes unsustainable.</p><p>That’s the problem <strong>OpenID Connect Federation 1.0</strong> solves.</p><h3>What Is OpenID Connect Federation 1.0?</h3><p>First, let’s clear up a common misconception:</p><blockquote><strong><em>OpenID Connect (OIDC) ≠ OpenID Connect Federation</em></strong></blockquote><ul><li><strong>OpenID Connect (OIDC)</strong> is an authentication protocol built on OAuth 2.0 — it powers logins like “Sign in with Google.”</li><li><strong>OpenID Connect Federation 1.0</strong> is an <em>extension</em> of OIDC. It doesn’t handle authentication itself — instead, it manages <strong>how trust is established and scaled</strong> between IdPs and RPs.</li></ul><h4>Why Is OIDC Federation Better?</h4><p>Traditional OIDC setups require a <strong>manual exchange of configuration details</strong> — endpoints, keys, certificates, etc. That works for small setups, but it breaks down at scale.</p><p>OIDC Federation introduces a <strong>dynamic trust layer</strong>, using:</p><ul><li><strong>Entity Statements</strong> (digitally signed JSON metadata)</li><li><strong>Trust Chains</strong> (hierarchical, cryptographic validation paths)</li></ul><p>Here’s how it works:</p><ol><li>Every party (IdP, RP, or federation operator) is a <strong>Federation Entity</strong>.</li><li>Each publishes a signed <strong>Entity Statement</strong> describing its configuration.</li><li>A <strong>Trust Chain</strong> links an entity to a <strong>Trust Anchor</strong> — the federation’s top-level authority.</li><li>When an RP interacts with an IdP, it validates the trust chain <strong>dynamically</strong> — no pre-configured relationships required.</li></ol><p>As long as both entities share a common trust anchor, trust can be established <strong>on the fly</strong>.</p><p>Let’s break it down further.</p><h3>How It Works</h3><h4>1. Discovering Federation Entities</h4><p>When an RP needs to authenticate a user via an IdP, it queries the federation for <strong>Entity Statements</strong> , rather than relying on static configurations.</p><h4>2. Entity Statements</h4><p>Entity Statements are signed JSON documents that include:</p><ul><li>OIDC metadata (e.g., endpoints, supported claims)</li><li>Public keys</li><li>Policy information</li></ul><p>Because they’re signed, RPs can <strong>verify them cryptographically</strong>, without manual validation.</p><h4>3. Trust Chain Resolution</h4><p>RPs don’t trust IdPs blindly. They verify that:</p><ul><li>The Entity Statement is signed by a <strong>trusted federation operator</strong></li><li>A valid trust chain connects the IdP to a <strong>Trust Anchor</strong></li></ul><p>This ensures the IdP is authentic and policy-compliant.</p><h4>4. Validating Metadata and Policies</h4><p>RPs also evaluate <strong>federation-wide policies</strong> (e.g., security algorithms, token lifetimes). If everything checks out, trust is established.</p><h4>5. Dynamic Trust Establishment</h4><p>Once validated, the RP accepts the IdP’s tokens — <strong>without manual pre-configuration</strong>.</p><p>This process is:</p><ul><li>🔄 Automated (no human errors)</li><li>📈 Scalable (works for thousands of entities)</li><li>🔐 Secure (crypto-backed and auditable)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NUvr3xvoRJQAFz9zMwRsCg.png" /><figcaption>How OpenID Connect Federation 1.0 Automates Trust</figcaption></figure><h3>Why It Matters</h3><p>OpenID Connect Federation 1.0 isn’t just another spec — it’s a response to real, painful problems faced by those managing identity at scale.</p><p>Here’s why it’s a game-changer:</p><h4>🔄 Dynamic Trust at Scale</h4><p><em>Say goodbye to hardcoded trust relationships</em>. Trust is established <strong>dynamically</strong> using signed metadata and discoverable trust chains.</p><blockquote>Onboarding a new RP or IdP? Just publish an entity statement — the rest is automatic.</blockquote><h4>🔐 Stronger, Auditable Trust</h4><p>All metadata is digitally signed. That means:</p><ul><li>You know it’s authentic</li><li>You can audit it.</li><li>You can trust it — just like TLS certificates</li></ul><h4>🌐 Cross-Sector Interoperability</h4><p>Governments, universities, healthcare systems, and SaaS vendors can all participate in a single federation — or bridge across multiple federations — using <strong>shared trust anchors</strong>.</p><h4>🧩 Policy Enforcement Built In</h4><p>Federation operators can define policies (e.g., signing algorithms, token lifetimes) that are <strong>automatically applied and enforced</strong>.</p><h4>💼 Reduced Operational Overhead</h4><p>No more XML wrangling or certificate-chasing. The federation model is:</p><ul><li>Easier to maintain</li><li>Easier to scale</li><li>Easier to trust</li></ul><h3>Real-World Use Cases and Adoption</h3><p>OpenID Connect Federation 1.0 is already being adopted in <strong>complex, high-stakes environments</strong>:</p><h4>🇪🇺 European Digital Identity (eIDAS 2.0)</h4><p>The EU’s pan-European identity vision requires <strong>federated trust across borders</strong>. OIDC Federation supports dynamic interoperability between digital wallets, public services, and private vendors.</p><h4>🎓 Higher Education and Research</h4><p>Federations like <strong>eduGAIN</strong> and <strong>InCommon</strong> are exploring OIDC Federation to replace SAML — enabling mobile-ready, decentralized identity for research institutions.</p><h4>🏛️ Government Identity Platforms</h4><p>Countries like Sweden, Germany, and Finland are piloting federation-based models for secure access to public services, reducing the overhead of onboarding new agencies and services.</p><h4>🛠️ Multi-Tenant SaaS &amp; B2B</h4><p>Large SaaS vendors can let enterprise customers <strong>bring their own IdP</strong> — securely, without manual pre-registration. This is <strong>federation-as-a-service</strong>, and it scales.</p><h3>Challenges and Considerations</h3><p>Like any new model, OIDC Federation comes with trade-offs:</p><h4>Learning Curve</h4><p>Concepts like <strong>entity statements</strong> and <strong>trust chains</strong> can feel abstract at first — especially for teams used to simpler SAML or OIDC setups.</p><blockquote><strong>Tip:</strong> Start small. Set up a sandbox federation and experiment.</blockquote><h4>Tooling and Library Support</h4><p>The ecosystem is still growing. Some tooling may require custom development — but community contributions are growing fast.</p><h4>Governance Complexity</h4><p>Federation introduces new questions:</p><ul><li>Who is your trust anchor?</li><li>Who approves federation operators?</li><li>How are policies enforced?</li></ul><p>These are <strong>organizational and governance</strong> questions — not just technical ones.</p><h4>Migrating from Static Trust</h4><p>If you’re using static metadata today, transitioning to federation requires <strong>a mindset and architectural shift</strong> — but the benefits are significant.</p><h3>The Future of Federated Identity</h3><p>OpenID Connect Federation 1.0 represents a <strong>new identity trust model</strong> — dynamic, policy-driven, and scalable.</p><p>As digital ecosystems grow more complex, the old way of manually wiring trust just won’t hold. We need a model where:</p><ul><li>Trust is verifiable, not assumed</li><li>IdPs and RPs can find and validate each other</li><li>Federations support agility, not overhead</li></ul><p>We’re witnessing the <strong>next chapter</strong> in internet identity.</p><p>Governments, universities, and SaaS platforms are already adopting it. The tooling and ecosystem are maturing rapidly.</p><p><strong>OpenID Connect Federation is not just the future — it’s already here.</strong></p><h3>Key Takeaways</h3><p>🔑 <strong>OpenID Connect Federation 1.0</strong>:</p><ul><li>Extends OIDC with dynamic, scalable trust mechanisms</li><li>Replaces manual metadata with signed entity statements and trust chains</li><li>Enables automated, policy-compliant federation across sectors</li><li>Is being adopted by governments, higher education, and large-scale platforms</li><li>Requires new thinking around trust, governance, and architecture</li></ul><h3>🚀 <strong>Want to explore further?</strong></h3><ul><li><strong>Read the spec</strong>: <a href="https://openid.net/specs/openid-connect-federation-1_0.html">OpenID Connect Federation 1.0 Specification</a></li><li><strong>Review your architecture</strong>: If you manage many OIDC or SAML connections, federation may simplify your setup.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5ed937bbd40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The ABCs of Scalable REST API Design]]></title>
            <link>https://medium.com/@nitesh_17214/the-abcs-of-scalable-rest-api-design-cd5df3b7648a?source=rss-22064e87ff84------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd5df3b7648a</guid>
            <category><![CDATA[scalable]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Nitesh Singh]]></dc:creator>
            <pubDate>Fri, 09 Feb 2024 06:04:05 GMT</pubDate>
            <atom:updated>2024-02-09T06:09:13.709Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Remember Good code is written, but great code is crafted.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FMwGV1eWMwvArcNBPw3zXg.jpeg" /></figure><h3>What is REST API?</h3><p>In the world of web development, REST API has become a cornerstone for building flexible and scalable applications. REST, which stands for Representational State Transfer, is an architectural style that defines a set of principles for creating web services. These services, known as RESTful APIs, allow different software systems to communicate with each other over the Internet in a standardized and efficient way.</p><h3>What is an API?</h3><p>An Application Programming Interface (API) defines the rules that you must follow to communicate with other software systems.</p><p>Developers expose or create APIs so that other applications can communicate with their applications programmatically.</p><blockquote>In short, Web APIs act as a gateway between clients and resources on the web.</blockquote><h4>Clients</h4><p>Clients are the users who want to access information from the web. The Client can be a person or a software system that uses the API.</p><h4>Resources</h4><p>Resources are the information that different applications provide to their clients. Resources can be images, videos, text, numbers, or any type of data.</p><p>The machine that gives the resource to the client client is also called the server.</p><h3>1. HTTP Verbs or HTTP Methods</h3><p>HTTP defines a set of request methods to indicate the desired action to be performed for a given resource.</p><p>These verbs specify the type of operation that a client wishes to perform on a server’s resource when sending an HTTP request.</p><p>The Primary and most commonly used HTTP verbs are <strong>POST, GET, PUT, PATCH, and DELETE</strong>. These correspond to <strong><em>create, read, update, and delete (or CRUD) operations.</em></strong></p><blockquote>Note: There are several other verbs, too, but are utilized less frequently. Of those less-frequent methods, <strong>OPTIONS and HEAD</strong> are used more often than others.</blockquote><h4>GET</h4><p>The Get Method is used to <strong><em>retrieve data from the server</em></strong>. When a client sends a GET request, it is seeking information without making any modifications to the server’s resources.</p><h4><strong>POST</strong></h4><p>POST is used when a client wants to <strong>submit data to be processed by a specified resource</strong>. POST requests are commonly <strong><em>utilized when creating a new resource</em></strong> or when the operation is not strictly read-only.</p><h4>PUT</h4><p>PUT is an HTTP method used for updating a resource or creating a new one if it does not exist. Clients typically use PUT to update existing resources with new data.</p><blockquote><strong>So, What is the difference between POST and PUT? 🤔</strong></blockquote><blockquote>The difference between POST and PUT is that PUT requests are <strong>idempotent</strong>. That is, calling the same PUT request multiple times will always produce the same result. In contrast, calling a POST request repeatedly has the side effect of creating the same resource multiple times.</blockquote><h4>PATCH</h4><p>The PATCH method is used when a client needs to apply partial modifications to a resource on the server.</p><h4>DELETE</h4><p>DELETE is the HTTP method used when a client wants to request the removal of a specific resource on the server.</p><h4>OPTIONS</h4><p>When a client sends an OPTIONS request, the server responds with details about the supported methods, headers, and other potential capabilities of the resource.</p><h4>HEAD</h4><p>The HEAD method is similar to GET, but it is designed to retrieve only the headers of a resource without the accompanying body.</p><p>HEAD requests are useful when clients need information about a resource’s metadata without downloading the entire content, optimizing the network efficiency.</p><h3>2. URL Structure</h3><p>In the competitive landscape of APIs, a well-designed URL is not just a technicality; it’s the user-friendly gateway to seamless interaction. Users prefer clarity and reliability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*THSgW_6Qu1tGVf9zJcw18g.png" /><figcaption>Typical API Request</figcaption></figure><p>The URL of an API is its foundation, playing a crucial role in user experience. An exemplary API URL is like a guide with three key traits:</p><h4>Self-Explanatory:</h4><ul><li>Craft the URL so that it should convey its purpose and functionality.</li><li>The client should intuitively understand the endpoint’s role without consulting extensive documentation.</li></ul><p>e.g. Unclear URL:</p><pre>/api/v1/getBookInfo?id=123</pre><p>Clear URL:</p><pre>/api/v1/books/123</pre><p>In the clear example, the URL is self-explanatory, indicating that we are dealing with books and specifically requesting information about the book with ID 123.</p><h4>Consistent:</h4><ul><li>Maintain a consistent URL structure throughout the API.</li><li>This consistency aids users in quickly grasping the API’s organization and reduces the learning curve.</li><li>Adopt standardized naming conventions for endpoints and parameters.</li></ul><p>e.g.Inconsistent URL:</p><pre>/api/v1/books/123<br>/api/v1/authors/456<br>/api/v1/getLibraryStatus</pre><p>Consistent URL:</p><pre>/api/v1/books/123<br>/api/v1/authors/456<br>/api/v1/library/status</pre><p>Consistency is maintained in the second example by adopting a uniform structure (/api/v1/) and ensuring that endpoints related to books and authors follow the same pattern.</p><h4>Predictable:</h4><p>When Clients can predict the structure and behavior of a URL, they gain a powerful tool for efficient integration and utilization. Predictable URLs build trust by assuring users that the API follows a logical and understandable flow.</p><p>To achieve these principles we need to follow these:</p><h4>The Protocol Should be HTTPS</h4><ul><li>HTTPS ensures secure communication by encrypting data between the client and the server.</li><li>Security is paramount, and using HTTPS instills trust in clients by safeguarding their data during API interactions.</li></ul><h4>Domain Name:</h4><ul><li>Choose a domain name that reflects the purpose of your API.</li><li>Utilize a Fully Qualified Domain Name (FQDN) for a clear and complete identification of the server. For FQDN, it should have api in its name. e.g.https://api.myapp.com</li><li>Including “api” in the domain name, communicates the nature of the service.</li></ul><h4>The API Word</h4><ul><li>If the domain lacks “api” in its name, simply appending “/api” after the domain makes it clear that users are engaging with an API. e.g. <a href="https://www.myapp.com/api">https://www.myapp.com/api</a></li><li>It can be part of the domain name itself. e.g. <a href="https://googleapis.dev/nodejs/googleapis/latest/">https://googleapis.dev/nodejs/googleapis/latest</a></li><li>The api word creates a straightforward and self-explanatory URL structure, aiding users in understanding the purpose of the endpoint and emphasizing that this URL is for API not for the website.</li></ul><h4>Version</h4><p>Specifying version numbers clearly and consistently is a good practice in API design.</p><ul><li>Always use natural numbers for versioning, ensuring simplicity and easy understanding.</li><li>Consider prefixing the version number with “v” (e.g., v1, v2) for additional clarity. This makes it explicit that it represents a version.</li><li>e.g. <a href="https://www.myapp.com/api/v1">https://www.myapp.com/api/v1</a></li></ul><blockquote>Versioning is a crucial part of API design. It gives developers the ability to improve their API without breaking the client’s applications when new updates are rolled out.</blockquote><h4>Entity</h4><ul><li>Resource names should be descriptive nouns representing the entity they represent. For example, use “user” instead of “getUsers” or “createUser.”</li><li>Keep resource names as a single word,</li><li>avoid the use of verbs or actions.</li><li>e.g. Good: /api/v1/user /api/v1/book /api/v2/travel</li><li>Avoid: /api/v1/getUsers /api/v1/createBook /api/v1/updateOrder</li></ul><h4>ID Parameter</h4><p>When dealing with specific entities in a RESTful API, the optional use of an ID in the URL is a common and effective practice</p><ul><li>The entity ID is an optional part of the URL, appended after the resource endpoint. e.g. /api/v1/order/123</li><li>The entity ID is particularly relevant for operations like GET, PUT, PATCH, and DELETE, where specific entities are targeted.</li></ul><h4>Sub Entities</h4><p>When working with sub-entities in a RESTful API, it’s crucial to establish rules that promote consistency, clarity, and effective resource management</p><ul><li>It is used for accessing entities that are dependent on other entities.</li><li>Choose clear and consistent names for sub-entities. The name should reflect the relationship to the parent entity. For example, if dealing with comments related to a post, consider /posts/{postId}/comments.</li><li>Embed sub-entities in the URL path using a nested structure. This enhances clarity and reflects the hierarchical relationship between entities. For instance, /api/v1/posts/{postId}/comments/{commentId}.</li></ul><h4>Query Parameters</h4><p>Used to query the entities in the GET Method.</p><ul><li>Employ clear and descriptive names for query parameters. Choose names that succinctly convey their purpose, promoting understanding. For example, use startDate and endDate instead of ambiguous terms.</li><li>When using multiple query parameters, separate them with the “&amp;” symbol for clarity. For instance, ?param1=value1&amp;param2=value2.</li></ul><p>Query parameters are used in a RESTful API to customize and filter API responses based on specific requirements or conditions. Here are common scenarios when query parameters are beneficial:</p><ul><li><strong>Filtering Data</strong>: Use query parameters to filter data based on specific criteria. For example, filtering a list of users based on their status or filtering products by category.</li></ul><pre>GET /api/v1/users?status=active<br>GET /api/v1/products?category=electronics</pre><ul><li><strong>Sorting Results</strong>: Allow clients to specify the order in which results are returned. For Example, sorting products by price or sorting articles by publication date.</li></ul><pre>GET /api/v1/products?sort=price<br>GET /api/v1/articles?sort=date</pre><ul><li><strong>Pagination</strong>: Implement query parameters for pagination to manage large sets of data efficiently. e.g.</li></ul><pre>GET /api/v1/posts?page=2&amp;pageSize=10</pre><ul><li><strong>Search Operations</strong>: Facilitate search functionality by using query parameters to pass search criteria. e.g.</li></ul><pre>GET /api/v1/books?search=programming</pre><h3>3. Response Codes</h3><p>HTTP status codes play a crucial role in communicating the outcome of a request to clients in a RESTful API.</p><ul><li>Adhere to standard HTTP status codes for common scenarios. For example, use 200 for successful requests, 404 for not found, and 500 for internal server errors.</li><li>Choose status codes that accurately reflect the outcome of the request. Avoid generic codes if more specific information can be conveyed.</li></ul><p>Here are guidelines for using response codes effectively:</p><ol><li><strong>2xx — Success: </strong>Use the 2xx series for successful responses. For instance, 200 OK for a successful GET request, 201 Created for successful resource creation, and 204 No Content for a successful request with no response body.</li><li><strong>3xx — Redirection</strong>: Employ the 3xx series for redirection scenarios. Commonly used codes include 301 Moved Permanently and 302 Found.</li><li><strong>4xx — Client Errors</strong>: Utilize the 4xx series for client errors, indicating issues with the client’s request. For example, 400 Bad Requests for malformed requests and 404 Not Found for resources that cannot be located.</li><li><strong>5xx — Server Errors</strong>: Implement the 5xx series for server errors, signifying issues on the server side. For instance, 500 Internal Server Error for general server problems and 503 Service Unavailable for temporary unavailability.</li></ol><p>Refer to <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Status">MDN for more</a>.</p><h3>4. Authentication and Authorization</h3><p>Authentication and authorization are crucial aspects of API design, ensuring that APIs are secure and that only authorized users or systems can access and perform specific actions.</p><h4><strong>Authentication — Who is the user?</strong></h4><p>Authentication is the process of verifying the identity of a user, application, or system trying to access an API. It ensures that the entity making a request is who it claims to be. There are various authentication mechanisms in API design:</p><blockquote><strong>API Keys</strong>: Simple and commonly used, API keys are unique per client, sent with each request, but vulnerable if not handled securely</blockquote><blockquote><strong>JWT (JSON Web Tokens)</strong>: JWT is a compact, URL-safe token for claims representation between parties, signed and capable of including user information, known for its stateless nature and scalability benefits.</blockquote><blockquote><strong>Basic Authentication</strong>: Basic Authentication employs a username and password, Base64-encoded and sent with each request, recommended for use over HTTPS to encrypt credentials.</blockquote><blockquote><strong>Certificate-based Authentication</strong>: Certificate-based Authentication involves presenting a digital certificate instead of traditional credentials, offering a high level of security but may be more complex to implement.</blockquote><blockquote><strong>OAuth (Open Authorization)</strong>: OAuth is a delegated authorization framework that allows third-party applications to secure access to resources on behalf of the resource owner, using tokens (access and refresh tokens).</blockquote><h4><strong>Authorization — What is he allowed to do?</strong></h4><p>Authorization determines the actions a user, application, or system is allowed to perform once they have been authenticated. It’s about defining and enforcing access controls:</p><blockquote><strong>Role-Based Access Control (RBAC)</strong>: RBAC involves assigning users specific roles with corresponding permissions, streamlining access management, and reducing complexity in authorization.</blockquote><p><em>Example:</em> In a web application, an administrator might have a role with permissions to manage users, while regular users have a role allowing them to view and edit their profile information.</p><blockquote><strong>Attribute-Based Access Control (ABAC)</strong>: ABAC makes access decisions based on attributes such as user characteristics or environmental conditions, providing more granular control compared to RBAC.</blockquote><p><em>Example:</em> In a healthcare system, access to patient records might be controlled based on attributes such as the user’s role (doctor, nurse) and the patient’s medical condition.</p><blockquote><strong>OAuth Scopes</strong>: In OAuth, scopes are utilized to restrict the permissions of a token, defining the actions or data a client application is allowed to access.</blockquote><p><em>Example:</em> In a social media application using OAuth, user authentication might include scopes like “read_posts” and “write_comments,” restricting the client application’s access to specific actions.</p><blockquote><strong>Policy-Based Authorization</strong>: Policy-based authorization employs rules or policies to determine who can perform specific actions and under what circumstances, offering flexibility but potentially introducing complexity in management.</blockquote><p><em>Example:</em> In a financial system, a policy might be defined to restrict fund transfer operations to users with a specific role (“financial_manager”) and only during business hours, adding a time-based constraint.</p><h3>5. Performance</h3><p>Performance is a critical aspect of API design, as it directly impacts the user experience, scalability, and efficiency of the applications relying on the API. Here are several considerations for optimizing performance in API design:</p><blockquote><strong><em>Use Efficient Data Formats</em></strong>: Choose lightweight and efficient data formats like JSON or Protocol Buffers to reduce the payload size, leading to faster data transmission.</blockquote><p><em>Example:</em> Instead of using XML, opt for JSON as it is a more lightweight and human-readable data format, reducing the size of API responses.</p><blockquote><strong><em>Caching</em></strong>: Implement caching mechanisms to store frequently accessed data on the client side or intermediate servers, reducing the need for redundant API calls.</blockquote><p><em>Example:</em> Cache frequently requested static data, such as product information, on the client side to reduce the need for repeated API calls.</p><blockquote><strong>Pagination</strong>: Employ pagination techniques for large data sets to retrieve and display only the necessary amount of information, avoiding the transfer of unneessary data.</blockquote><p><em>Example:</em> Implement pagination parameters (e.g., page and limit) to retrieve a specific subset of data, such as a page of 10 results at a time.</p><blockquote><strong>Compression</strong>: Enable data compression (e.g., gzip) to reduce the size of payloads during transmission, leading to faster data transfer times.</blockquote><p><em>Example:</em> Enable gzip compression in the API server to reduce the size of response payloads during data transmission.</p><blockquote><strong>Asynchronous Operations</strong>: For time-consuming tasks, offer asynchronous APIs or background processing to avoid blocking the client and improve responsiveness.</blockquote><p><em>Example:</em> Offer an asynchronous API endpoint for resource-intensive tasks, such as image processing or file uploads, to avoid blocking the client during the operation.</p><blockquote><strong>Load Balancing</strong>: Implement load balancing to distribute incoming API requests across multiple servers, preventing overload on a single server and improving overall system performance.</blockquote><p><em>Example:</em> Use a load balancer to distribute incoming API requests across multiple servers, preventing overload on any single server and improving overall system performance.</p><blockquote><strong>Optimized Database Queries</strong>: Optimize database queries to ensure they are efficient and utilize indexes, reducing the time required to fetch or update data.</blockquote><p><em>Example:</em> Use database indexing to optimize queries, ensuring that common operations like user authentication or data retrieval are performed efficiently.</p><blockquote><strong>Rate Limiting</strong>: Implement rate limiting to prevent abuse, control traffic, and ensure fair usage of the API resources, maintaining a stable and responsive service.</blockquote><p><em>Example:</em> Enforce rate limiting on the API to restrict the number of requests a client can make within a specified period, preventing abuse and ensuring fair usage.</p><h3>Conclusion</h3><p>In conclusion, grasping the fundamentals of REST API lays a solid foundation for constructing modern and interoperable web applications. It is a powerful architectural style that simplifies communication between different software components, offering simplicity, scalability, and consistency. As you embark on your journey to explore RESTful APIs, keep in mind the key concepts of resources, HTTP methods, URIs, statelessness, and representation. These principles will guide you in creating APIs that are not only efficient but also adhere to widely accepted industry standards. Feel free to experiment and refine your understanding, and remember that the beauty of REST lies in its simplicity and versatility.</p><p>If you encounter any errors in this article or have questions, don’t hesitate to seek clarification and iterate on your knowledge. The learning process involves continuous improvement, and if there are any mistakes, feel free to correct them as you enhance your understanding of REST API design. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd5df3b7648a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing React App Deployment to S3 with TravisCI]]></title>
            <link>https://medium.com/@nitesh_17214/code-to-cloud-react-app-deployment-to-s3-with-travis-ci-unleashed-828c420e3bc4?source=rss-22064e87ff84------2</link>
            <guid isPermaLink="false">https://medium.com/p/828c420e3bc4</guid>
            <category><![CDATA[travis-ci]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Nitesh Singh]]></dc:creator>
            <pubDate>Sat, 30 Dec 2023 18:47:30 GMT</pubDate>
            <atom:updated>2024-01-06T13:46:58.849Z</atom:updated>
            <content:encoded><![CDATA[<h3>Code to Cloud: Unleashing React App Deployment to S3 with TravisCI</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*prv6bMtn3VguKigS1bCpDQ.png" /></figure><h3>Introduction</h3><blockquote>Deploying a React application flawlessly can be a game-changer in the fast-paced world of online development, where every line of code matters. “<strong>Code to Cloud: Unleashing React App Deployment to S3 with TravisCI</strong>” is a thorough guide that will help you maximize the benefits of automation, efficiency, and dependability in your deployment pipeline. Welcome to the trip.</blockquote><p>In this article, we’ll look at how to deploy React applications to <strong><em>AWS S3</em></strong> using <strong><em>Travis CI</em></strong>, a powerful ally. But that’s not all. We’ll move on to the next stage once our React app has found a home on AWS S3: accessing it via <strong><em>AWS CloudFront</em></strong>. CloudFront offers scalability, security, and lightning-fast performance. Finally, we’ll investigate integrating a custom domain with <strong><em>Route 53</em></strong> to make your React application truly stand out on the vast web.</p><p>So, whether you’re a seasoned developer seeking deployment finesse or a newcomer eager to understand the intricacies, buckle up for a journey where code meets cloud, and deployment becomes an art form.</p><p>Ready to turn the complex into the comprehensible? Let’s dive in!</p><h3>Prerequisites</h3><p>Before diving into the exciting world of deployment let’s ensure you have the right tools and knowledge at your fingertips. Here are the prerequisites to make the most out of this guide:</p><ol><li><strong>React Basics</strong>: Ensure a basic understanding of React.js, covering components, JSX syntax, and state management.</li><li><strong>GitHub Account</strong>: Have a GitHub account for working with repositories and leveraging GitHub Actions. <a href="https://github.com/">Create one here</a>.</li><li><strong>Travis CI</strong>: Sign up for a Travis CI account to configure automated builds and deployments. <a href="https://travis-ci.com/">Create an account here</a>.</li><li><strong>AWS</strong>: Basic knowledge of AWS is recommended. <a href="https://aws.amazon.com/">Sign up here</a> as we’ll create an S3 bucket, configure CloudFront, and use Route 53 for DNS management.</li><li><strong>Node.js and npm</strong>: Ensure Node.js and npm are installed for managing React dependencies. <a href="https://nodejs.org/">Download Node.js here</a>.</li></ol><h4><em>Why Travis CI, you might ask?</em></h4><p>Travis CI is more than just a continuous integration tool; it’s a key player in automating the deployment pipeline. Imagine a world where your React applications effortlessly transition from code repositories to live environments, all with the push of a button. Travis CI makes this dream a reality, and we’re here to guide you through every step.</p><h3>Setting Up AWS</h3><p>Amazon Web Services (AWS) is the most extensive and widely used cloud platform in the world, offering over 200 fully functional services from data centres all over the world. AWS is being used by millions of customers to cut costs, improve security, become more agile, and develop more quickly. These clients include the biggest corporations, fastest-growing startups, and top government agencies.</p><h4>1. Getting AWS Credentials</h4><ul><li>Begin by accessing the AWS Management Console (<a href="https://aws.amazon.com/">https://aws.amazon.com/</a>).</li><li>Use your AWS account credentials to sign in.</li><li>Navigate to the Identity and Access Management (IAM) service dashboard.</li><li>On the IAM dashboard, locate and select “Users” from the options available on the left-hand menu.</li><li>Initiate the creation of a new IAM user by clicking on the “Add user” button.</li><li>Furnish relevant details for the new user, including a meaningful username.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*44AeOoTWe4Or0lz6Dsybkg.png" /><figcaption>Specifying User Details</figcaption></figure><ul><li>Attach policies to the user based on the specific permissions needed. Common policies include “AmazonS3FullAccess” for comprehensive S3 access.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6G6odVLDmUAz1_VRuvXHQQ.png" /><figcaption>Set permissions and attach policies</figcaption></figure><ul><li>Before finalizing, review the user details and assigned permissions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*13I0aCXXejtR71EeAfGPYA.png" /><figcaption>Review user and create</figcaption></figure><ul><li>Click “Create user” to complete the user creation process.</li><li>After Successful user creation, View the user details and click on “Create access key” in the summary section</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0rGuXQ-cvxAXx5tI1Hh4A.png" /><figcaption>View User Details</figcaption></figure><ul><li>Click on Third-party Service and tick I understand checkboxand then next.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qv13-i4CjSUe71Jytsu1jg.png" /><figcaption>Create Access Key</figcaption></figure><ul><li>Safely store these credentials as they won’t be retrievable later.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTKmM06bT9-AE2TEL01LkQ.png" /><figcaption>Access key Created</figcaption></figure><p>Note: Exercise caution in securely managing and storing these credentials, avoiding exposure in public repositories or unsecured locations.</p><h4>2. Setting up a static website on S3</h4><p>Start with an AWS-crafted tutorial that will walk you through the easy process of setting up a static website on Amazon S3. Note that I have used the bucket name “<strong><em>aws-react-app</em></strong>” throughout to maintain consistency. If you choose a different name, make sure you make the appropriate change to the Dockerfile, which you will create in the later part, to guarantee a smooth deployment.</p><h3>Setting up the React App</h3><h4>1. Creating a React Application</h4><p>To avoid the intricacy of setting up a React application from the beginning, we will utilize <strong><em>create-react-app</em></strong>. It’s a boilerplate builder that will produce all of our requirements.</p><p>You only need to execute one command in the terminal to create your React app:</p><pre>npx create-react-app aws-react-app</pre><p>Navigate to the <em>aws-react-app</em> folder and run the following command to install dependencies:</p><pre>npm install</pre><p>Run the application by following the command</p><pre>npm run start</pre><p>This will open the following page immediately in your default browser if everything is correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jQnAZlLdevlptjX65JlwBw.png" /></figure><h4>2. Creating Dockerfile</h4><p>Now, create a file called Dockerfile in the project’s root folder.</p><pre>FROM node:21-alpine as base<br><br>#STAGE 1: Depedency Phase<br>FROM base as deps<br><br>RUN apk add --no-cache libc6-compat<br><br>WORKDIR /app<br><br>COPY package.json yarn.lock ./<br><br>RUN yarn<br><br>#STAGE 2: Runner Phase<br><br>FROM base as builder<br><br>WORKDIR /app<br><br>COPY --from=deps /app/node_modules ./node_modules<br><br>COPY . .<br><br>RUN yarn run build<br><br>#STAGE 3: Push Build Folder To S3<br><br>FROM mesosphere/aws-cli<br><br>WORKDIR /app<br><br>COPY --from=builder  /app/build .<br><br>CMD [&quot;s3&quot;, &quot;sync&quot;, &quot;./&quot;, &quot;s3://aws-react-app&quot;]</pre><p>This Dockerfile follows a multi-stage build approach, optimizing the final image size by separating the dependency installation, application build, and deployment steps into distinct stages.</p><p>This Dockerfile is divided into three stages, each serving a specific purpose in the deployment process of a React application.</p><h4>Stage 1: Base Image and Dependency Phase</h4><p>In this stage, a base image is selected (node:21-alpine). It then extends this base image to create a separate stage (deps). This stage installs the necessary dependencies for the application using Alpine Linux package manager (apk) and sets up the working directory. The package.json and yarn.lock files are copied, and the project dependencies are installed using Yarn.</p><h4>Stage 2: Builder Phase</h4><p>In the second stage (builder), the Dockerfile continues from the base image. It sets the working directory, copies the node_modules directory from the previous stage (deps), and then copies the entire project into the container. Finally, it builds the React application using the yarn run build command.</p><h4>Stage 3: Push Build Folder to S3</h4><p>In the third stage, the Dockerfile switches to the mesosphere/aws-cli image, which provides the AWS CLI tools. It sets the working directory, copies the build folder from the builder stage, and finally, synchronizes the contents of the current directory with an S3 bucket (s3://aws-react-app) using the AWS CLI.</p><p><strong>Testing Dockerfile</strong></p><p>We’ll test our docker files locally to ensure that everything works properly. Run this command to build the docker container</p><pre>docker build -t aws-react-app .</pre><p>To run this container we need AWS Credentials which will be passed as environment variables</p><pre>docker run \<br>  -e AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID \<br>  -e AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY \<br>  -e AWS_DEFAULT_REGION=YOUR_AWS_DEFAULT_REGION \<br>  aws-react-app</pre><p>If the deployment was successful, you should see the following output in your terminal, which shows the files that were successfully uploaded to S3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pcTsFvCepFV687pCVMX9FQ.png" /><figcaption>On Successful Deployment</figcaption></figure><h4>3. Creating a Git repository</h4><p>To add your project to GitHub, make a git repository there and follow the guidelines.</p><h3>Travis CI Configuration</h3><p>Travis CI is more than just a continuous integration tool; it’s a key player in automating the deployment pipeline. Imagine a world where your React applications effortlessly transition from code repositories to live environments, all with the push of a button. Travis CI makes this dream a reality, and we’re here to guide you through every step.</p><p><strong>Adding a </strong><strong><em>.travis.yml</em> File</strong></p><p>Within the project’s root folder Create a <strong><em>.travis.yml</em></strong> configuration file to serve as the blueprint for Travis CI. This YAML file will house essential settings and instructions for the subsequent build and deployment processes.</p><p><strong>Configuring Build and Deployment Scripts:</strong></p><p>Add the following to your .travis.yml file</p><pre>dist: bionic<br>language: node_js<br>node_js: &quot;16&quot;<br><br>services:<br>  - docker<br><br>branches:<br>  only:<br>    - main<br><br>jobs:<br>  include:<br>    - stage: Frontend Deployment<br>      name: &quot;Run Frontend Deployment&quot;<br>      script:<br>        - docker build -t aws-react-app .<br>      deploy:<br>        provider: script<br>        script:<br>          - bash ./deploy.sh<br>        on:<br>          branch: main<br></pre><p>To better comprehend this, let’s dissect code.</p><ul><li>dist: bionic: Specifies the Ubuntu distribution to use for the build environment. In this case, it&#39;s using Ubuntu 18.04 (Bionic).</li><li>language: node_js: Declares the primary programming language for the project, which is Node.js.</li><li>node_js: &quot;16&quot;: Specifies the Node.js version to use, in this case, version 16.</li><li>services: docker: Indicates that Docker will be used as a service during the build process.</li><li>jobs: Defines the different stages and jobs for the build process.</li><li>Inside jobs, the Frontend Deployment stage is added. Where we are first building a docker container with the command docker build -t aws-react-app .</li><li>deploy: Specifies the deployment configuration.</li><li>provider: script: Indicates that a custom script will handle the deployment. We will have to create a deploy.sh file.</li><li>script: Contains the deployment script, in this case, a Bash script located at deploy.sh.</li><li>on: branch: main: Specifies that the deployment should occur when changes are pushed to the main branch.</li></ul><p><strong>creating deploy.sh file</strong></p><p>create a deploy.sh file and the following content</p><pre><br>echo &quot;Deploying frontend to AWS S3 bucket aws-react-app&quot;<br><br>docker run \<br>  -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \<br>  -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \<br>  -e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \<br>  aws-react-app</pre><p>We are accessing the AWS Credentials using variables because it is strongly advised against adding those directly to the script. The process of adding these credentials will be covered after some time.</p><p>final folder structure should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*JyHGhKFwqm9u-Y3kWb3T0Q.png" /><figcaption>folder structure</figcaption></figure><p><strong>Travis CI and Github Repo Linking</strong></p><p>To connect Github Repositories to Travis CI You must log in using your Github account and adhere to the instructions.</p><p>By establishing this link, Travis CI will initiate builds and deployments based on the configurations outlined in the .travis.yml file, fostering a cohesive integration between your codebase and continuous integration processes.</p><p><strong>Adding AWS Credentials to Travis CI Environments</strong></p><p>Since TravisCI will be executing commands that will interface with our account, we must provide valid credentials to confirm access to the AWS account. In particular, we need to include the following information that we generated in the AWS section above.</p><ul><li>AWS_ACCESS_KEY_ID: Unique identifier for AWS account access.</li><li>AWS_SECRET_ACCESS_KEY: Secret key for secure AWS account access.</li><li>AWS_DEFAULT_REGION: Default AWS region for resource management.</li></ul><p>To add these, Go to your Travis CI project page. Under “More Options” go to settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZn1MmW648TBrrYiQrlhXg.png" /><figcaption>Adding Env variables</figcaption></figure><p>Under “Environment Variables,” add the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGIONvariables with their corresponding values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2e21nlOi4AnkZ5uEFqfO4g.png" /></figure><h4>Testing Deployment Pipeline</h4><p>Now, that we have completed all the steps it is time to test our pipeline.</p><ul><li>Just make some changes in your code and push it to Git Hub repo using the following commands</li></ul><pre>git add .<br>git commit -m &quot;some changes&quot;<br>git push</pre><ul><li>Visit the Travis CI website (<a href="https://travis-ci.com/">https://travis-ci.com/</a>) and sign in with your GitHub account.</li><li>Access your repository’s dashboard to monitor the ongoing build triggered by the recent push.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CkUslRuQlANjKbwbYvImsQ.png" /><figcaption>Travis Building Application and Deployment in progress</figcaption></figure><ul><li>Explore the build logs to identify any errors or issues.</li><li>After successful deployment logs will be look something like this.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JR-YfXEaSPKmeC9YEqiCeQ.png" /><figcaption>Deployment Success</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SOzealR0enwLo-sWbO7ikA.png" /><figcaption>On Deployment Success</figcaption></figure><p>A successful Travis CI build signifies that your project adheres to the defined continuous integration process, ensuring that changes are seamlessly integrated and do not introduce regressions.</p><h3>Set up AWS CloudFront</h3><p>Amazon CloudFront is a web service designed to enhance the distribution of static and dynamic web content, including HTML, CSS, JavaScript, and images. It operates through a global network of data centers known as edge locations, ensuring efficient content delivery to users. CloudFront routes user requests to the edge location with the lowest latency, optimizing performance for a seamless and responsive user experience.</p><p>CloudFront delivers content instantly if it’s in the optimal edge location; otherwise, it retrieves content from a designated origin, such as Amazon S3, MediaPackage, or an identified HTTP server. Refer to <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Introduction.html">Official documentation</a> for more details.</p><h4>How to Configure AWS CloudFront?</h4><ul><li><strong>Create CloudFront Distribution:</strong> Go to the CloudFront console and click on ‘Create Distribution’.</li><li><strong>Configure Origin:</strong> Under ‘Origin’, for ‘Origin Domain’, choose your S3 instance. Like I have selected <em>aws-react-app</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sNPP336YQsfVjt6woJ9S5w.png" /></figure><ul><li><strong>Redirect HTTP to HTTPS: </strong>In the ‘Default Cache Behavior Settings’, set ‘Viewer Protocol Policy’ to Redirect HTTP to HTTPS. This forces users to connect to your CloudFront distribution with HTTPS for secure connections.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9CvBmDbwVF2_51kfZMxMA.png" /></figure><blockquote>Note: Configuring CNAME and SSL Certificates is only needed if you want to use your custom domain instead of the AWS CloudFront URL e.g. I want to host the application on niteshsingh.live</blockquote><ul><li><strong>Configure CNAMEs: </strong>under the ‘Distribution Settings’, in the ‘Alternate Domain Names (CNAMEs)’ field, enter your domain name and its www variant, like this: domain.com and <a href="http://www.domain.com/">www.domain.com</a></li><li><strong>Custom SSL Certificate: </strong>Under the ‘Distribution Settings’, for ‘SSL Certificate’, choose ‘Custom SSL Certificate (example.com)’. From the dropdown list, choose the certificate that matches your domain name. Click on Request Certificate if you don’t already have a certificate and follow the instructions to generate one.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-w2d8zRJ7NSP_rW49DrhHg.png" /></figure><ul><li>Enter the Default root Object as <strong>index.html</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-PJTZ3XSXdDnBmVdD0Q2A.png" /></figure><ul><li>Finally, click on ‘Create Distribution’. This process might take a while.</li><li>View the distribution details, and make a note of the domain name as it may be needed later. You can also visit this URL to access the hosted application.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VRvApF7UlRHl1oberuwYIw.png" /></figure><h3>Setting Up Route 53</h3><p>Amazon Route 53 is a highly available and scalable <a href="https://aws.amazon.com/route53/what-is-dns/">Domain Name System (DNS)</a> web service. Route 53 connects user requests to internet applications running on AWS or on-premises. Refer to the<a href="https://aws.amazon.com/route53/"> official documentation</a> for more details.</p><blockquote>Note: This Step is only needed if you want to use your custom domain instead of the AWS CloudFront URL e.g. I want to host the application on niteshsingh.live</blockquote><h4>Configuring Route 53</h4><ul><li>Navigate to Route 53 Dashboard</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QsoTC5iFAJPghZ9-3hcOQA.png" /><figcaption>Route 53 Dashboard</figcaption></figure><ul><li>Click on Hosted Zones and Find your domain.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OodYHgt56U2IRtfgB8kcJQ.png" /></figure><ul><li>Click on Create Record</li><li>Follow These steps to create record</li></ul><ol><li>Enter the record name as www.</li><li>Select Record Type as A</li><li>Switch On Alias Toggle Button</li><li>Select Alias to CloudFront distribution from the dropdown.</li><li>Select your CloudFront distribution. If your CloudFront distribution is not listed enter the domain of cloudfront manually.</li></ol><p>6. Click on Create Records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jzZxw0VVPdQcOBe-P8GwUg.png" /></figure><p>After some time your domain will be live.</p><h3>Conclusion</h3><p>For your convenience, the entire codebase for this deployment adventure can be found on our <a href="https://github.com/Nitesh-BB/aws-react-app">GitHub repository</a>. Feel free to explore, fork, and adapt it to suit your specific project needs. The repository serves as a comprehensive reference, encapsulating the intricacies of deploying a React application with GitHub, Travis CI, and AWS S3.</p><p>Let’s recap the enriching journey thus far:</p><ul><li>Configuring and automating the deployment pipeline with GitHub and Travis CI.</li><li>Creating a Dockerized React app for efficient deployment.</li><li>Securely managing AWS credentials for programmatic access.</li><li>Configuring a static website on Amazon S3 for hosting our React app.</li><li>Using CloudFront to serve the website efficiently</li><li>Using Route 53 and Cloudfront for accessing the website using a custom domain.</li></ul><p>Whether you encounter triumphs or challenges in implementing these deployment strategies, your feedback is immensely appreciated.</p><p>Thanks for Reading</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=828c420e3bc4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create OIDC Client in Nodejs]]></title>
            <link>https://medium.com/@nitesh_17214/how-to-create-oidc-client-in-nodejs-b8ea779e0c64?source=rss-22064e87ff84------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8ea779e0c64</guid>
            <category><![CDATA[passportjs]]></category>
            <category><![CDATA[openid-connect]]></category>
            <category><![CDATA[oidc-client-js]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[oauth2]]></category>
            <dc:creator><![CDATA[Nitesh Singh]]></dc:creator>
            <pubDate>Sun, 25 Jul 2021 13:21:40 GMT</pubDate>
            <atom:updated>2021-07-25T13:21:40.761Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In this artice we will see how to implement OpenID Client in Nodejs using Passport and openid-client.</p><blockquote>If you want to implement your own OAuth2.0 Authorization server, you can follow my this <a href="https://medium.com/@nitesh_17214/oauth-2-0-authorization-server-using-nodejs-and-expressjs-cf65860fed1e">article</a>.</blockquote><h3>Step-By-Step Implementation</h3><blockquote>Note : I will use oidc-provider which I had created in previous article and it is running on <a href="http://localhost:3000/oidc"><strong>http://localhost:3000/oidc</strong></a></blockquote><blockquote>You can use any oidc-provider.</blockquote><ol><li>we will use npm to create our oidc-client project, First, let’s create our project directory, then we run the init command.</li></ol><pre>mkdir OIDC-Client<br>cd OIDC-Client<br>npm init -y</pre><p>2. Install required packages</p><pre>npm install express nodemon cookie-parser express-session</pre><pre>or</pre><pre>yarn add express nodemon cookie-parser express-session</pre><p>3. create an index.js file and write following codes to create simple server</p><pre>const express       = require(&#39;express&#39;);<br>const session       = require(&#39;express-session&#39;);<br>const cookieParser  = require(&#39;cookie-parser&#39;);<br>const path          = require(&quot;path&quot;);<br>const http          = require(&quot;http&quot;);</pre><pre>const app = express();<br>app.use(cookieParser());<br>app.use(express.urlencoded({<br>   extended: true,<br>}));</pre><pre>app.set(&#39;views&#39;, path.join(__dirname, &#39;views&#39;));<br>app.set(&#39;view engine&#39;, &#39;ejs&#39;);<br>app.use(express.static(path.join(__dirname, &#39;public&#39;)));</pre><pre>app.use(session({<br>     secret: &#39;secret&#39;,                  <br>     resave: false,                  <br>     saveUninitialized: true,}));</pre><pre>const httpServer = http.createServer(app)<br>httpServer.listen(8080,() =&gt;{<br>     console.log(`Http Server Running on port 3004`)<br>})</pre><p>4. Now , Install <a href="https://www.npmjs.com/package/passport">passport</a> ,<a href="https://www.npmjs.com/package/openid-client">openid-client</a> and <a href="https://www.npmjs.com/package/helmet">helmet</a></p><p>I am sure you must be familiar with passport and helmet. if not let’s see in brief.</p><h4>passport</h4><p>— Passport is authentication middleware for Node.js. It’s sole purpose is to authenticate requests, which it does through an extensible set of plugins known as <em>strategies</em>.</p><p>for this project I am going to use <em>openid-client </em>strategies.</p><h4><em>openid-client</em></h4><p>— openid-client is a server side OpenID Relying Party (RP, Client) implementation for Node.js runtime.</p><h4>helmet</h4><p>— Helmet helps us to secure our Express apps by setting various HTTP headers.</p><pre>npm install passport openid-client helmet</pre><pre>or </pre><pre>yarn add passport openid-client helmet</pre><p>5. Import passport and helmet . To use passport in Express-based application , we will have to configure following middlewares.</p><pre>const passport = require(&#39;passport&#39;);<br>const helmet = require(&#39;helmet&#39;);</pre><pre>//Helmet midddleware<br>app.use(helmet());</pre><pre>//Passport Middlewares<br>app.use(passport.initialize());<br>app.use(passport.session());</pre><p>6. Passport maintains persistent login sessions. In order for persistent sessions to work, the authenticated user must be serialized to the session, and deserialized when subsequent requests are made.</p><pre>passport.serializeUser((user, done) =&gt; {<br>    console.log(&#39;-----------------------------&#39;);<br>    console.log(&#39;serialize user&#39;);<br>    console.log(user);<br>    console.log(&#39;-----------------------------&#39;);<br>    done(null, user);<br>});</pre><pre>passport.deserializeUser((user, done) =&gt; {<br>    console.log(&#39;-----------------------------&#39;);<br>    console.log(&#39;deserialize user&#39;);<br>    console.log(user);<br>    console.log(&#39;-----------------------------&#39;);<br>    done(null, user);<br>});</pre><p>7. import Issuer and Strategy from openid-client and discover an Issuer configuration using its published .well-known endpoints</p><pre>const { Issuer,Strategy } = require(&#39;openid-client&#39;);</pre><pre>Issuer.discover(&#39;http://localhost:3000/oidc&#39;) <br>.then(function (oidcIssuer) {<br>     var client = new oidcIssuer.Client({<br>           client_id: &#39;oidcCLIENT&#39;,<br>           client_secret: &#39;client_super_secret&#39;,<br>           redirect_uris: [&quot;http://localhost:8080/login/callback&quot;],<br>           response_types: [&#39;code&#39;],</pre><pre>});</pre><pre>passport.use(&#39;oidc&#39;, new Strategy({ client,passReqToCallback: true}, (req, tokenSet, userinfo, done) =&gt; {<br>     console.log(&quot;tokenSet&quot;,tokenSet);<br>     console.log(&quot;userinfo&quot;,userinfo);</pre><pre>        // do whatever you want with tokenset and userinfo</pre><pre>     req.session.tokenSet = tokenSet;<br>     req.session.userinfo = userinfo;<br>     <br>    return done(null, tokenSet.claims());<br>}));<br>});</pre><p>8. Create routes for login, login callback</p><pre>app.get(&#39;/login&#39;,</pre><pre>(req, res, next) =&gt; {<br>     console.log(&#39;-----------------------------&#39;);<br>     console.log(&#39;Login Handler Started&#39;);<br>     next();<br>},<br>passport.authenticate(&#39;oidc&#39;,{scope:&quot;openid&quot;}));</pre><pre>app.get(&#39;/login/callback&#39;,(req,res,next) =&gt;<br>{<br>   passport.authenticate(&#39;oidc&#39;,{ <br>      successRedirect: &#39;/user&#39;,<br>      failureRedirect: &#39;/&#39; })<br>      (req, res, next)<br>})</pre><p>create home route and /user route</p><pre>app.get(&quot;/&quot;,(req,res) =&gt;{<br>   res.send(&quot; &lt;a href=&#39;/login&#39;&gt;Log In with OAuth 2.0 Provider &lt;/a&gt;&quot;)</pre><pre>})</pre><pre>app.get (&quot;/user&quot;,(req,res) =&gt;{</pre><pre>res.header(&quot;Content-Type&quot;,&#39;application/json&#39;);   </pre><pre>res.end(JSON.stringify({tokenset:req.session.tokenSet,userinfo:req.session.userinfo},null,2));</pre><pre>})</pre><p>9. So Our Final index.js will be like this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5a0021bc73bb54dd16e487066c805b5/href">https://medium.com/media/e5a0021bc73bb54dd16e487066c805b5/href</a></iframe><p>10 . Run index.js to start server</p><pre>nodemon index.js</pre><p>11 . Go to <a href="http://localhost:8080/">http://localhost:8080</a> on browser. and click on “Log in with OAuth 2.0 Provider”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KzOdM6YX_bpP2ucG12_7gw.jpeg" /></figure><p>12. You will be redirected to OAuth Provider Login Page. As I am using prevoiusly created oidc-provider which is running on <a href="http://localhost:3000/oidc">http://localhost:3000/oidc</a> so it will take me following page</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDrQCUjsC2cubf8dvQMEsg.jpeg" /></figure><p>put any random username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bazhrXxCwHC7mP0-luGhtw.jpeg" /></figure><p>After you continue it will redirect us to client redirect url</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-gdqnKsKSbjpPE9vekaclw.jpeg" /></figure><p>Voilla..!! You got access_token</p><h4>How to get userinfo from this access_token ?</h4><p>Copy access_token and and go to postman and make a post request with this access_token to userinfo endpoint (you can get this endpoint in .well-known/openid-configuration of provider).</p><p>put access_token in x-www-form-urlencoded and send, you will get userinfo in response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6jIW4s34llqqd5G9WT1Zw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8ea779e0c64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OAuth 2.0 Authorization Server using NodeJS and ExpressJS]]></title>
            <link>https://medium.com/@nitesh_17214/oauth-2-0-authorization-server-using-nodejs-and-expressjs-cf65860fed1e?source=rss-22064e87ff84------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf65860fed1e</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[openid]]></category>
            <category><![CDATA[openid-connect]]></category>
            <dc:creator><![CDATA[Nitesh Singh]]></dc:creator>
            <pubDate>Sat, 24 Jul 2021 16:42:27 GMT</pubDate>
            <atom:updated>2021-07-25T13:25:20.337Z</atom:updated>
            <content:encoded><![CDATA[<h3>OAuth 2.0 Authorization Server using NodeJS and ExpressJS (Part-1)</h3><h3><strong>Introduction</strong></h3><p>This Article is basically about How to Implement your own OpenID Connect (OIDC) Provider in NodeJS using node <a href="https://github.com/panva/node-oidc-provider">oidc-provider</a> library.</p><blockquote>If you want to implement OIDC Client in Nodejs, you can follow my this <a href="https://medium.com/@nitesh_17214/how-to-create-oidc-client-in-nodejs-b8ea779e0c64">article</a>.</blockquote><h3>Prerequisite</h3><p>In this article we are not going to learn how OAuth works..So, It is highly recommended to read once about following topics:</p><ul><li>What is OAuth 2.0?</li><li>What are different Grant Types in OAuth 2.0 and what are there flow ?</li><li>What is OpenID Connect and How It is different from OAuth 2.0 ?</li></ul><p>Lets go through some basic terms used in this article.</p><h3>Table of Contents</h3><ol><li><a href="#54fa"><strong><em>Brief Description of OAuth 2.0</em></strong></a></li></ol><ul><li><a href="#2e88"><em>What is OAuth 2.0 ?</em></a></li><li><a href="#e5fc"><em>What Is OpenID Connect ?</em></a></li><li><a href="#e57f"><em>OAuth 2.0 Grant Types</em></a></li><li><a href="#c2f6"><em>Parameters for Auth endpoint</em></a></li><li><a href="#42e3"><em>How openID Connect Works ?</em></a></li></ul><p><strong><em>2. </em></strong><a href="#489a"><strong><em>Step-By-Step Implemetation Of own OpenID Connect Provider</em></strong></a></p><p><strong><em>3. </em></strong><a href="#f0cd"><strong><em>Testing of created OIDC provider</em></strong></a></p><h3><em>1. Brief Description of OA</em>uth 2.0</h3><h4><strong>1.1. What is OAuth 2.0 ?</strong></h4><ul><li>The <em>OAuth 2.0</em> authorization framework is a protocol that allows a user to grant a third-party web site or application access to the user’s protected resources, without necessarily revealing their long-term credentials or even their identity.</li><li>Remember It is Authorization, not Authentication.</li></ul><h4><strong>1.2. What Is OpenID Connect ?</strong></h4><ul><li><em>OpenID Connect (OIDC)</em> is an identity layer built on top of the OAuth 2.0 framework.</li><li>It allows third-party applications to verify the identity of the end-user and to obtain basic user profile information.</li></ul><h4><strong>1.3. OAuth2.0 vs OIDC</strong></h4><ul><li>The first thing to understand is that OAuth 2.0 is an authorization <em>framework</em>, not an authentication protocol.</li><li>From a technical perspective, the big difference between OpenID Connect and OAuth 2.0 is the <strong>id_token</strong>–there is no <strong>id_token</strong> defined in OAuth 2.0 because it is specific to federated authentication.</li><li>The <strong>id_token</strong> provides an additional layer of security to user sign in transactions by adding:</li></ul><p><em>— A nonce, which is sent by the client and enables the integrity of the response to be validated.</em></p><p><em>— A hash of the access token.</em></p><p><em>— A hash of the code (optional)</em></p><h4>1.4. OAuth 2.0 Grant Types :</h4><p>OAuth 2.0 defines four flows to get an access token. These flows are called grant types.</p><ol><li>Authorization Code Flow</li><li>Implicit Flow with Form Post</li><li>Resource Owner Password Flow</li><li>Client Credentials Flow</li></ol><p>Lets see in brief about these grants Types. For more details you can <a href="https://auth0.com/docs/flows">read here</a></p><h4>1.4.1 Authorization Code</h4><ul><li>Flow used by Web Apps executing on a server.</li><li>This is also used by mobile apps, using the <a href="https://auth0.com/docs/flows/authorization-code-flow-with-proof-key-for-code-exchange-pkce">Proof Key for Code Exchange (PKCE) technique</a>.</li><li>Because regular web apps are server-side apps where the source code is not publicly exposed, they can use the Authorization Code Flow, which exchanges an Authorization Code for a token.</li><li>During authentication, mobile and native applications can use the Authorization Code Flow, but they require additional security. Additionally, single-page apps have special challenges. To mitigate these, OAuth 2.0 provides a version of the Authorization Code Flow which makes use of a Proof Key for Code Exchange (PKCE).</li></ul><h4>1.4.2. Implicit Flow With Form Post</h4><ul><li>used by JavaScript-centric apps (Single-Page Applications) executing on the user’s browser.</li><li>It is intended for Public Clients, or applications which are unable to securely store Client Secrets. While this is no longer considered a best practice for requesting Access Tokens, when used with Form Post response mode, it does offer a streamlined workflow if the application needs only an ID token to perform user authentication.</li></ul><h4>1.4.3. Resource Owner Password Flow</h4><ul><li>used by highly-trusted apps.</li><li>Though we do not recommend it, highly-trusted applications can use the Resource Owner Password Flow, which requests that users provide credentials (username and password), typically using an interactive form. The Resource Owner Password Flow should only be used when redirect-based flows (like the Authorization Code Flow) cannot be used.</li></ul><h4>1.4.4. Client Credentials Flow</h4><ul><li>used for machine-to-machine communication.</li><li>With machine-to-machine (M2M) applications, such as CLIs, daemons, or services running on your back-end, the system authenticates and authorizes the app rather than a user. For this scenario, typical authentication schemes like username + password or social logins don’t make sense. Instead, M2M apps use the Client Credentials Flow</li></ul><h4>1.5. Parameters for Auth endpoint</h4><pre><a href="https://demov1.rif4u.com:3221/auth?response_type=code&amp;redirect_uri=https://demov1.rif4u.com:1443/auth/login/callback&amp;scope=profile&amp;client_id=oidcCLIENT">http://localhost:3000/auth?response_type=code&amp;redirect_uri=http://localhost:8080/login/callback&amp;scope=profile&amp;client_id=oidcCLIENT</a></pre><h4>response_type</h4><p>response_type will be set to code, indicating that the application expects to receive an authorization code if successful.</p><h4>client_id</h4><p>The client_id is the public identifier for the app.</p><h4>redirect_uri</h4><p>This URL must match one of the URLs the developer registered when creating the application, and the authorization server should reject the request if it does not match.</p><h4>scope</h4><p>The request may have one or more scope values indicating additional access requested by the application. The authorization server will need to display the requested scopes to the user.</p><h4>state</h4><p>The state parameter is used by the application to store request-specific data and/or prevent CSRF attacks. The authorization server must return the unmodified state value back to the application.</p><h4>1.6 How OpenID Connect Works ?</h4><p>The application starts with an OAuth flow that asks the user to authorize a request. As part of that flow, the client will include the OpenID Connect scope along with scopes for any additional information it wants about the user.</p><p>After the request is processed, the client will receive an access token as well as an ID token issued by the authorization server that contains claims that carry information about the user. The user’s SSO experience is made possible by the delivery of the ID token from the authorization server to the client. The client can then contact a special endpoint on the authorization server known as the UserInfo endpoint to receive the remaining claims about the user.</p><p>OpenID Connect also defines mechanisms for discovery and session management beyond OAuth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*4gmJiWWYMt-hwlgymErlkQ.jpeg" /><figcaption>How OpenID Connect works ?</figcaption></figure><h3><strong><em>2. Step-By-Step Implemetation Of own OpenID Connect Provider</em></strong></h3><ol><li>We will use npm to create our oidc-provider project, First, let’s create our project directory, then we run the init command</li></ol><pre>mkdir OIDC<br>cd OIDC<br>npm init -y</pre><p>2. Install required packages</p><pre>npm i express nodemon oidc-provider ejs</pre><pre>or </pre><pre>yarn add express nodemon oidc-provider ejs</pre><p>3. create a index.js file and write following codes</p><pre>const express = require(&#39;express&#39;);</pre><pre>const app = express();</pre><pre>//Middlewares<br>app.use(express.static(__dirname + &#39;/public&#39;));<br>app.set(&#39;views&#39;, path.join(__dirname, &#39;views&#39;));<br>app.set(&#39;view engine&#39;, &#39;ejs&#39;);</pre><pre>app.listen(3000, function () {<br>  console.log(&#39;OIDC is listening on port 3000!&#39;);<br>});</pre><p>4. Add OIDC Configuration in index.js</p><pre>const { Provider } = require(&#39;oidc-provider&#39;);</pre><pre>const configuration = {<br>clients: [{<br>     client_id: &quot;oidcCLIENT&quot;,<br>     client_secret: &quot;Some_super_secret&quot;,<br>     grant_types: [&quot;authorization_code&quot;],<br>     redirect_uris: [ &quot;http://localhost:8080/auth/login/callback&quot;],<br>     response_types: [&quot;code&quot;,],<br>     <em>//other configurations if needed<br></em>}],<br>pkce: {<br>required: () =&gt; false,<br>},<br>};</pre><pre>const oidc = new Provider(&#39;http://localhost:3000&#39;, configuration);<br>app.use(&quot;/oidc&quot;,oidc.callback());</pre><p>So Final index.js will be something like this.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c63486e91a2056a567b76c0f429b9f40/href">https://medium.com/media/c63486e91a2056a567b76c0f429b9f40/href</a></iframe><p>5. Run application by</p><pre>nodemon index.js</pre><p>6. You can view configuration of openid by visiting following link, You will see page similar to below</p><pre><a href="http://localhost:3000/oidc/.well-known/openid-configuration">http://localhost:3000/oidc/.well-known/openid-configuratio</a>n</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y0mGARPXfxYp6nwtNICmrA.jpeg" /></figure><p>Congatulations !! You have created Your Own basicOIDC Provider.</p><p>For customized OIDC Provider read more <a href="https://github.com/panva/node-oidc-provider">here</a>.</p><h3><strong><em>3. Testing of created OIDC provider</em></strong></h3><p>Let’s See how to test our created OIDC-Provider</p><ol><li>Implement Your own OIDC-client</li></ol><blockquote>follow this beautiful <a href="https://medium.com/@nitesh_17214/how-to-create-oidc-client-in-nodejs-b8ea779e0c64">article</a>.</blockquote><p>2. We can also test using Online oidc debugger.</p><ol><li>Go to <a href="https://oidcdebugger.com/">https://oidcdebugger.com/</a> or you can use any oidc clientof your choice.</li><li>Fill your oidc-provider details like this</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oh0KGkydIGn05L8vGveo_g.jpeg" /></figure><p>3. Add <a href="https://oidcdebugger.com/debug">https://oidcdebugger.com/debug</a> to redirect_uri in index.js</p><pre>redirect_uris: [ &quot;<a href="https://oidcdebugger.com/debug">https://oidcdebugger.com/debug</a>&quot;],</pre><p>4. After Clicking Send request, You will see PAge like this, Enter any data in the fields and signIn. These Pages are default pages provided by oidc-provider</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hDrQCUjsC2cubf8dvQMEsg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bazhrXxCwHC7mP0-luGhtw.jpeg" /></figure><p>5 . After Continuing , You will A success page like below… You can see in this page a code is generated…</p><p>SInce it is Authrorization code flow so it will not able to generate Token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*smmVXHChpAURZAKV28WoyQ.jpeg" /></figure><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf65860fed1e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>