<?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: Ifechukwu Obiezue Emmanuel</title>
    <description>The latest articles on DEV Community by Ifechukwu Obiezue Emmanuel (@ifechukwuobiezue).</description>
    <link>https://dev.to/ifechukwuobiezue</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%2F819047%2F68c1dbe0-9bc3-48ab-8fa9-13deb6808ef8.jpeg</url>
      <title>DEV Community: Ifechukwu Obiezue Emmanuel</title>
      <link>https://dev.to/ifechukwuobiezue</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ifechukwuobiezue"/>
    <language>en</language>
    <item>
      <title>Effective Software Development Workflow: From Idea to Delivery</title>
      <dc:creator>Ifechukwu Obiezue Emmanuel</dc:creator>
      <pubDate>Mon, 23 Sep 2024 11:54:40 +0000</pubDate>
      <link>https://dev.to/ifechukwuobiezue/effective-software-development-workflow-from-idea-to-delivery-47d8</link>
      <guid>https://dev.to/ifechukwuobiezue/effective-software-development-workflow-from-idea-to-delivery-47d8</guid>
      <description>&lt;p&gt;Imagine building a complex structure like a skyscraper. You need a well-thought-out plan, careful execution, and continuous checks to ensure it's safe and meets all requirements. In the world of software development, we follow a similar process known as the Software Development Life Cycle (SDLC). It's our step-by-step guide from the initial idea to a functional software product. In this in-depth article, we will break down all the key stages in SDLC.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Effective Software Development Workflow:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is the process of turning a software idea into a functional, reliable, and valuable product. Effective Software Development Workflow emphasizes efficiency, quality, and success. It involves the following stages:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;IDEATION:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;The ideation stage is the first stage of the software development process. It involves identifying a problem or an opportunity and devising a software solution. It's all about generating ideas, clear objectives, scope, and defining project goals. To further explain this concept, we will break it down into:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Identifying the Problem or Opportunity:&lt;/strong&gt; This is the first and crucial step that sets the direction for the entire project. It involves recognizing a specific need, challenge, or market gap that software can address.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;For instance, a busy restaurant where customers complain about long wait times. This is an opportunity to develop a mobile app for customers to place orders in advance.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Setting Clear Objectives:&lt;/strong&gt; After identifying a problem or opportunity, define clear and specific objectives. What are the desired outcomes of the software solution? These objectives should be measurable and aligned with the organization's goals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Determining the Scope:&lt;/strong&gt; This is essential to understand the boundaries and limitations. it means outlining exactly what the software will do and what it won't. This helps keep the project on track and prevents unnecessary features or work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Target Audience and User Needs:&lt;/strong&gt; Understanding the target audience is crucial. Who will use the software, and what are their needs and preferences? Conduct user research or market analysis to gather insights into user behavior and expectations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Budget and Timeline:&lt;/strong&gt; Establishing a budget is necessary for the management of resources. This includes estimating costs for development, testing, marketing, and maintenance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Additionally, setting a realistic timeline helps ensure that the project stays on track and is delivered on time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Market Analysis:&lt;/strong&gt; Studying the target market to identify potential users, competitors, and trends. This analysis helps you make informed decisions to create software that stands out in the competitive landscape.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Proof of Concept and Prototyping:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;POC helps determine if your idea is achievable before developing it into a product.&lt;/p&gt;

&lt;p&gt;Prototyping means creating a model of your product that provides an idea of how it will function.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Documentation:&lt;/strong&gt; It's essential to document the concept thoroughly. This documentation may include a concept document, a project brief, or a project charter. These documents serve as a reference for all stakeholders involved in the software development process.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Importance of a Clear Project Concepts and Objectives:&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Alignment:&lt;/strong&gt; They ensure that all team members and stakeholders are on the same page, working towards a shared vision.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Focus:&lt;/strong&gt; They provide a clear direction, helping the team maintain focus on achieving their goals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;: They reduce misunderstandings, prevent scope creep, and streamline the development process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Motivation&lt;/strong&gt;: Clear objectives give the team a sense of purpose and motivation to achieve the project's goals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They enable progress tracking and assessment of project success against defined goals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It aids in decision-making during the development process&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Requirements Gathering:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After solidifying your ideas, the next step is gathering requirements. It involves collecting and documenting the needs and expectations of the stakeholders. It helps define what the software needs to achieve, its functionalities, and its constraints. Requirements gathering involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stakeholder Involvement:&lt;/strong&gt; Engaging with stakeholders (clients or end-users) to understand their needs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Elicitation Techniques:&lt;/strong&gt; These are methods used to gather information or requirements from stakeholders. Various elicitation techniques employed to gather requirements include:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interviews:&lt;/strong&gt; one-on-one sessions with stakeholders to gather detailed information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Surveys and Questionnaires:&lt;/strong&gt; are distributed to a wider audience to collect structured responses.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observation:&lt;/strong&gt; observing how users work and interact with existing systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Workshops:&lt;/strong&gt; collaborative sessions where stakeholders discuss their requirements and expectations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prototyping:&lt;/strong&gt; creating prototypes to get feedback on design and functionality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Documentation:&lt;/strong&gt; documenting the information gathered in detail. This documentation includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functional Requirements: detailed descriptions of how the software should perform specific functions.&lt;/li&gt;
&lt;li&gt;Non-Functional Requirements: Criteria related to performance, security, usability, and other quality attributes.&lt;/li&gt;
&lt;li&gt;Use Cases: Scenarios that describe how the target users will use the software.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Prioritization:&lt;/strong&gt; prioritizing requirements to determine which are most critical for the project's success. This step helps guide the development process, particularly in cases with limited resources.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Review and Approval:&lt;/strong&gt; reviewing and approving the requirements by the stakeholders ensures alignment. Approval is an important milestone in the requirements gathering and analysis process.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Design and Architecture:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;They play vital roles in the software development workflow, helping to create the blueprint of the software.&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;The design phase focuses on how the software system will function, what it will look like, and how users will interact with it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For example, design is like a detailed plan for a house. It specifies the layout of rooms, the color of walls, the type of roof, and even the choice of furniture.&lt;/em&gt; The key aspects of design in SDLC include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User Interface (UI) Design:&lt;/strong&gt; Designers create the visual elements and layout of the software. UI design aims to ensure a user-friendly interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User Experience (UX) Design:&lt;/strong&gt; UX designers focus on user experience, ensuring that the software is intuitive and easy to navigate.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Functional Design:&lt;/strong&gt; Designers outline how the software will perform its functions. This stage defines the "what" and "how" of the software's capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Database Design:&lt;/strong&gt; This involves designing the data structure, database schema, and data flow within the system. It's essential for effective data storage and retrieval.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Component Design:&lt;/strong&gt; Designers detail the individual software components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Design:&lt;/strong&gt; This addresses potential vulnerabilities, data protection, and access control.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability and Performance Design&lt;/strong&gt;: This part focuses on optimizing the software's performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Software architecture provides the high-level structure and organization of the software system. It determines how various components will interact and how the system will meet specific goals.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;For example, architecture is like the structural framework of a house. It determines how strong the foundation is and where the walls and doors go.&lt;/em&gt; The key aspects of architecture in SDLC include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Architectural Styles:&lt;/strong&gt; We chose an architectural style based on project requirements and goals. Some architectural styles include:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Monolithic Architecture:&lt;/strong&gt; This involves building the entire application as a single integrated unit. It's simple but may be challenging to scale and maintain for complex systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Client-Server Architecture:&lt;/strong&gt; This divides the software into the client (user interface) and the server (data processing and storage). Common in web applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Microservices Architecture:&lt;/strong&gt; This involves dividing the software into small, independent services, each responsible for specific functionalities. This promotes flexibility and scalability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Serverless Architecture:&lt;/strong&gt; involves executing code in response to events without managing servers. This is ideal for event-driven applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Technology Stack Selection:&lt;/strong&gt; This involves selecting the programming languages, libraries, and tools for development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Flow and Management:&lt;/strong&gt; Architects define how data will flow through the system, from input to storage and output.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Architecture:&lt;/strong&gt; encompasses architectural decisions on authentication, authorization, encryption, and overall security measures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability and Load Balancing:&lt;/strong&gt; this ensures building the software to handle increased loads. This is often done through load balancing and redundancy measures.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Component Interaction:&lt;/strong&gt; It defines how different software components will interact within the system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integration:&lt;/strong&gt; specifies how the software will integrate with external systems or APIs. to ensure seamless communication.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Principles of Good Design and Architecture:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Dividing the software into smaller, manageable modules for easier maintenance and reusability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keeping the design as simple as possible while meeting requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Designing for the ability to handle increased loads or data without major changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dividing the software into distinct components, each responsible for a specific aspect, simplifies maintenance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maintaining consistent naming, coding styles, and user interface elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deciding on the database system and designing efficient data storage and retrieval mechanisms.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Development:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The heart of software development is the coding phase. These phases involve turning the design and architecture into a functioning software system. It is a crucial phase within the software development lifecycle and involves:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coding:&lt;/strong&gt; Developers write code using programming languages, following the design and architectural blueprints. This step transforms the high-level design and abstract concepts into actual software components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refactoring:&lt;/strong&gt; Developers refactor code if they identify issues, inefficiencies, or opportunities for improvement. Refactoring involves restructuring the code without changing its external behavior. It helps improve maintainability, performance, or reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strategies to promote collaboration and efficiency among development teams&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Efficient and collaborative development is essential for a successful software project. Let’s discuss some of these strategies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clear Communication:&lt;/strong&gt; Ensure that team members have open and clear communication channels. Use tools like messaging platforms, email, and video conferencing to help with information sharing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Project Management Tools:&lt;/strong&gt; Use project management tools such as &lt;a href="https://www.atlassian.com/software/jira/free" rel="noopener noreferrer"&gt;&lt;code&gt;Jira&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://trello.com/" rel="noopener noreferrer"&gt;&lt;code&gt;Trello&lt;/code&gt;&lt;/a&gt;, or &lt;a href="https://asana.com/" rel="noopener noreferrer"&gt;&lt;code&gt;Asana&lt;/code&gt;&lt;/a&gt; to track tasks, set deadlines, and monitor progress. These tools help in organizing and prioritizing work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Version Control:&lt;/strong&gt; Use version control systems like &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;&lt;code&gt;Git&lt;/code&gt;&lt;/a&gt; to track code changes and enable collaboration. This ensures that multiple developers can work on the same codebase without conflict.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Reviews:&lt;/strong&gt; Incorporate regular code reviews where team members review each other's code. Code reviews improve code quality and knowledge sharing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Automated Testing:&lt;/strong&gt; Use automated testing practices, including unit tests, integration tests, and CI/CD pipelines. These tools help catch and fix issues early in the development process.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You will learn more about this as you read.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pair Programming:&lt;/strong&gt; This is where two developers work together on the same codebase. This practice encourages knowledge sharing and immediate issue resolution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Agile Methodologies:&lt;/strong&gt; Adopt Agile methodologies like Scrum or Kanban to break work into smaller, manageable tasks with regular iterations. This fosters collaboration and adaptability.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You will learn more about this as you read.&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Regular Standup Meetings:&lt;/strong&gt; Conduct daily or weekly standup meetings to keep the team informed about progress. This promotes accountability and transparency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Documentation:&lt;/strong&gt; Maintain clear and up-to-date documentation for code, architecture, and processes. Documentation helps new team members understand the project and its components.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Collaboration Tools:&lt;/strong&gt; Use collaborative development tools such as &lt;a href="https://github.com" rel="noopener noreferrer"&gt;&lt;code&gt;GitHub&lt;/code&gt;&lt;/a&gt; or &lt;a href="https://about.gitlab.com/" rel="noopener noreferrer"&gt;&lt;code&gt;GitLab&lt;/code&gt;&lt;/a&gt;, which provide features like code hosting, issue tracking, pull requests, and wikis for a centralized, collaborative development environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Continuous Learning:&lt;/strong&gt; Encourage continuous learning and skill development among team members. This can include training, workshops, and knowledge-sharing sessions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Task Ownership:&lt;/strong&gt; Assign clear ownership of tasks and features. Developers are more likely to take ownership and responsibility for their work when they know they're accountable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cultural Fit:&lt;/strong&gt; Consider cultural fit when building development teams. A shared vision and values among team members can improve collaboration and cohesion.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Software Development Methodologies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Methodologies provide structured approaches for managing the software development process. Here are some of the methodologies used during the development phase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Agile:&lt;/strong&gt; Agile is a way of working that focuses on delivering value to customers early and often. It is an iterative and incremental approach, which means that teams work in short cycles and deliver working software at the end of each cycle. This allows teams to get feedback from customers early and often and to make changes to the software as needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;/strong&gt; &lt;em&gt;A team is building a new website for a restaurant. The team uses an Agile approach to break down the project into small, manageable pieces. They then work on one piece at a time and deliver it to the restaurant at the end of each week. The restaurant can then provide feedback on the work, and the team can make changes as needed.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scrum:&lt;/strong&gt; Scrum is an Agile framework that divides the project into short iterations called sprints. It promotes transparency, collaboration, and adaptability. Scrum teams have three defined roles, and there are:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Product Owner:&lt;/strong&gt; He or she handles the requirements for the software and ensures that the team is delivering value to the customer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scrum Master:&lt;/strong&gt; helps the team to follow the Scrum framework and to identify and remove any obstacles that will prevent the team from delivering.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Development Team:&lt;/strong&gt; The Development Team handles developing and delivering the software.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;: &lt;em&gt;A team is building a new mobile app for a fitness studio. The team uses the Scrum framework to manage the project. The Product Owner is the owner of the fitness studio. The Scrum Master is a senior developer on the team. The Development Team are the developers and a QA engineer.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;*The team works in two-week sprints. At the beginning of each sprint, the team selects a set of requirements from the product backlog to work on. The team then works on the selected requirements and delivers a working version of the app at the end of the spri*nt.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Kanban:&lt;/strong&gt; Kanban is an Agile approach that visualizes work items on a Kanban board, allowing teams to manage and optimize their workflow. It is particularly useful for projects with unpredictable workloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; There is a &lt;em&gt;new feature request to add the ability for users to upload photos to the app. The product owner adds the feature request to the To-Do column.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A developer takes the feature request from the To Do column and moves it to the In Progress column. The developer works on the feature by adding the necessary code to the app.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When the developer finishes, they move the feature request to the Testing column. A tester reviews the feature and tests it for any bugs.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If the tester finds any bugs, he or she moves the feature request back to the In Progress column for the developer to fix. If the tester does not find any bugs, he or she moves the feature request to the Done column.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The product owner then releases the new feature to users.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Quality Assurance and Testing:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We use quality assurance and testing to ensure that the software meets the desired quality and functionality.&lt;/p&gt;

&lt;p&gt;QA focuses on preventing defects and ensuring that the software development follows standards.&lt;/p&gt;

&lt;p&gt;Testing is a specific activity within the QA process that focuses on identifying defects or issues in the software&lt;/p&gt;

&lt;p&gt;Different types of testing, such as unit testing, integration testing, and user acceptance testing, help identify and fix defects. Let’s go through some of the testing processes mentioned above:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Unit Testing:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Unit testing focuses on verifying the correctness of individual components or units of code. These units are the smallest testable parts of the software, such as functions, methods, or classes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope:&lt;/strong&gt; developers execute it during the coding phase to ensure that each unit of code behaves as expected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing Approach:&lt;/strong&gt; Test cases focus on exercising specific functionalities or paths within a unit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt; Unit testing helps catch and address bugs and issues early in the development process. It also contributes to code quality, modularity, and maintainability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools:&lt;/strong&gt; Popular unit testing frameworks include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.cypress.io/" rel="noopener noreferrer"&gt;&lt;code&gt;Cypress(for JavaScript&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://junit.org/junit5/" rel="noopener noreferrer"&gt;&lt;code&gt;JUnit (for Java)&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://nunit.org/" rel="noopener noreferrer"&gt;&lt;code&gt;NUnit (for . NET)&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://nunit.org/" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://docs.pytest.org/en/7.1.x/getting-started.html" rel="noopener noreferrer"&gt;&lt;code&gt;PyTest (for Python)&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Integration Testing:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Evaluates how different units or components of the software interact when integrated. It ensures that these components work as a whole.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope:&lt;/strong&gt; It takes place after unit testing and involves testing the interactions between modules or components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing Approach:&lt;/strong&gt; Test cases focus on the communication and data flow between integrated components. We use various integration strategies to test these interactions. Some of these strategies include top-down, or incremental.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt; It helps identify issues that may arise from the combination of components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools:&lt;/strong&gt; There are various integration testing tools for different programming languages and platforms, but tools like &lt;a href="https://www.postman.com/" rel="noopener noreferrer"&gt;&lt;code&gt;Postman&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://jmeter.apache.org/" rel="noopener noreferrer"&gt;&lt;code&gt;Apache JMeter&lt;/code&gt;&lt;/a&gt; are widely used for testing APIs and web services.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;User Acceptance Testing (UAT):&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;UAT assesses whether the software meets the end-users' requirements and business needs. It is the final phase of testing before releasing the software to users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope:&lt;/strong&gt; End-users, product owners, or business analysts carry out UAT. it covers the entire application to ensure that it aligns with the users' expectations and performs as intended.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing Approach:&lt;/strong&gt; Test cases focus on real-life scenarios and use cases. Users perform tests that simulate actual use, verifying that the software meets their needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt; UAT ensures that the software is user-friendly and serves its intended purpose. It provides a final opportunity to catch any issues before a software release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools:&lt;/strong&gt; We can conduct UAT manually, often with the help of spreadsheets or test management tools for test case tracking. Some organizations may use automated UAT tools for specific scenarios.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Deployment:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After the development and testing phases, it's time to deploy the software for end-users. This involves setting up the production environment and migrating the code and data. CI/CD pipelines help automate the deployment process, making it more efficient and reliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CI/CD Pipelines&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CI/CD pipeline is an automated workflow that streamlines the software development and delivery process. It provides a consistent and repeatable process for building, testing, and deploying software. As the name implies it involves:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous integration (CI):&lt;/strong&gt; Developers merge their code changes into a central repository, triggering a build and testing process. If any tests fail, the system notifies the developers, enabling them to identify and resolve issues quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous delivery (CD):&lt;/strong&gt; Once the code has passed all tests, it is automatically deployed to a staging or production environment. This allows for frequent releases of software with minimal manual intervention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CI/CD Server:&lt;/strong&gt; This is a software application that automates the build, test, and deployment processes. Some popular CI/CD servers include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://semaphoreci.com/continuous-integration" rel="noopener noreferrer"&gt;&lt;code&gt;Semaphore&lt;/code&gt;&lt;/a&gt;: easy-to-use CI/CD with fast, customizable pipelines for efficient software delivery.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.jenkins.io/" rel="noopener noreferrer"&gt;&lt;code&gt;Jenkins&lt;/code&gt;&lt;/a&gt;: is an open-source automation server for customizable CI/CD pipelines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.travis-ci.com/" rel="noopener noreferrer"&gt;&lt;code&gt;Travis CI&lt;/code&gt;&lt;/a&gt;: Cloud-based CI/CD for open-source projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.gitlab.com/ee/ci/" rel="noopener noreferrer"&gt;&lt;code&gt;GitLab CI/CD&lt;/code&gt;&lt;/a&gt;: Integrated with GitLab, offering built-in CI/CD capabilities for easy development.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://azure.microsoft.com/en-us/products/devops" rel="noopener noreferrer"&gt;&lt;code&gt;Azure DevOps&lt;/code&gt;&lt;/a&gt;: Comprehensive CI/CD by Microsoft for software delivery&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://bitbucket.org/product/features/pipelines" rel="noopener noreferrer"&gt;&lt;code&gt;Bitbucket Pipelines&lt;/code&gt;&lt;/a&gt;: Integrated CI/CD within Bitbucket for seamless code testing and deployment.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Continuous Integration Workflow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pipelines in CI/CD are the series of steps used to build, test, and deploy software. The specific workflow in a CI pipeline will vary depending on the software. But generally, the steps are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Configuring the CI pipeline to know where to find the source code, what build tools to use, what tests to run, and where to deploy the software.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When a developer makes a change to the source code, they commit the change to a version control system such as Git.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The CI server triggers the CI pipeline when notified of a code change.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The CI pipeline builds the software by compiling the source code into an executable program.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The CI pipeline runs a series of tests on the software to ensure that it is working correctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the tests pass, the CI pipeline deploys the software to a staging or production environment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the tests fail, the CI pipeline notifies the developers so that they can fix the problem.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;This process is repeated every time a developer makes a change to the source code. This helps to ensure that software is built, tested, and deployed consistently and reliably.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For CD, we follow the same steps but since CD focuses on automating the deployment of code to production. CD will automatically release the code to production.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Maintenance and Update:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Maintenance and updates cannot be over-emphasized in software development. It is the ongoing effort to support, update, and enhance the software to keep it operational, secure, and relevant.&lt;/p&gt;

&lt;p&gt;Maintenance involves the activities required to keep software stable and free from errors. Maintenance activities include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Fixing Bugs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitoring and improving the performance of the software to ensure it runs efficiently.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security Updates&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensuring that the software complies with changing legal and regulatory requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Managing and optimizing the database to prevent data corruption or loss.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Providing support to users and addressing their questions and issues. Offering training and documentation to help users navigate the software.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensuring that the software remains compatible with new technologies. This includes new operating systems or web browsers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Updates involve making improvements, introducing new features, or enhancing existing ones. Updates deliver added value to users, respond to changing requirements, and stay competitive in the market. Update activities include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Testing updates to prevent new issues or regressions. This is done by the quality assurance teams&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Adding new features or improving existing ones based on user feedback, market trends, or changing business requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Improving User Interface (UI) and User Experience (UX).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Optimizing the software to enhance performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensuring that the software remains compatible with new technologies and platforms, such as mobile devices or new APIs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security Enhancements&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Informing users about the updates, their benefits, and any necessary changes to their workflows through release notes, in-app notifications, or email announcements.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Agile Approach to Maintenance and Updates:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Agile development, maintenance and updates are often managed through the product backlog. The development team adds bug fixes, security updates, and feature enhancements to the backlog. The product owner prioritizes these items and addresses them in sprints. This enables flexibility and responsiveness to changing user needs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strategies for ongoing support and improvements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Provide clear and concise documentation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Offer timely and responsive support.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Regularly release updates and patches.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Collect and analyze user feedback.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitor the software for usage and performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use continuous integration and continuous delivery (CI/CD).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Establish a culture of continuous improvement.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Effective software development requires a well-defined workflow from concept to delivery. By understanding the principles and strategies outlined in this guide, you'll be better equipped to manage and optimize your software development workflow, leading to successful project outcomes and satisfied stakeholders.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Mastering Modern Authentication in Web Applications: OAuth 2.0 Demystified</title>
      <dc:creator>Ifechukwu Obiezue Emmanuel</dc:creator>
      <pubDate>Sat, 21 Sep 2024 12:22:10 +0000</pubDate>
      <link>https://dev.to/ifechukwuobiezue/mastering-modern-authentication-in-web-applications-oauth-20-demystified-2b8b</link>
      <guid>https://dev.to/ifechukwuobiezue/mastering-modern-authentication-in-web-applications-oauth-20-demystified-2b8b</guid>
      <description>&lt;p&gt;In today's digital world, web applications have become integral to our daily lives. From social networking and email to online banking and shopping, as we entrust these applications, security has become a paramount concern. This write-up demystifies OAuth 2.0 and provides practical code examples to help you master it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication vs. Authorization
&lt;/h2&gt;

&lt;p&gt;Authentication and authorization are two essential concepts in computer security and access control. They serve distinct but interconnected purposes. In order to understand OAuth 2.0, we must understand the terms authentication and authorization.&lt;/p&gt;

&lt;p&gt;Authentication is the process of verifying the identity of a user, system, or entity. It focuses on "Who are you?" It ensures that the entity is who it claims to be.&lt;/p&gt;

&lt;p&gt;Authorization defines the actions or resources that a user has permission to access. It focuses on "What are you allowed to do?" It enforces access policies and permissions.&lt;/p&gt;

&lt;p&gt;Now that you understand authentication and authorization, let's explore OAuth 2.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is OAuth 2.0?
&lt;/h2&gt;

&lt;p&gt;OAuth 2.0 stands for Open Authorization 2.0 Framework. It is a framework for secure authorization and delegated access to protected resources, such as user data, on the web. It allows users to grant third-party applications limited access without sharing their credentials.&lt;/p&gt;

&lt;p&gt;To understand OAuth 2.0, we must define the fundamental concepts used within the protocol. To make these concepts easier to grasp, we will analyze OAuth 2.0 in the context of a common real-world scenario:&lt;/p&gt;

&lt;p&gt;Logging in to a random website with GitHub and accessing the &lt;a href="https://docs.github.com/en/rest?apiVersion=2022-11-28" rel="noopener noreferrer"&gt;GitHub REST API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this scenario, website will prompt the user to log in with GitHub. GitHub will then authenticate the user. Once GitHub has obtained the user's consent, it will issue an access token to the website. The website then uses the access token to access the REST API.&lt;/p&gt;

&lt;h3&gt;
  
  
  OAuth 2.0 roles
&lt;/h3&gt;

&lt;p&gt;In OAuth 2.0 terminology, GitHub in this scenario is the authorization server (AS).&lt;/p&gt;

&lt;p&gt;The authorization server (AS) handles authenticating the resource owner. It obtains their consent and issues access tokens to clients. It plays a central role in the OAuth 2.0 flow&lt;/p&gt;

&lt;p&gt;The REST API is a resource server(RS).&lt;/p&gt;

&lt;p&gt;The resource server hosts protected resources, which are HTTP endpoints, and needs an access token as a credential to authenticate a request. In the case of GitHub, these resources are repositories, issues, pull requests, and more.&lt;/p&gt;

&lt;p&gt;The Web application is the client&lt;/p&gt;

&lt;p&gt;The client is the third-party app that requests access to the resource owner's protected resources. The client uses the issued access token to access protected resources&lt;/p&gt;

&lt;p&gt;The user is the resource owner&lt;/p&gt;

&lt;p&gt;The resource owner is the end-user who owns the protected resources or credentials and has the authority to grant or deny access to them. The resource owner interacts with the client application to provide consent for access. In the GitHub scenario, the user is the one who creates the repositories, issues, pull requests, and more.&lt;/p&gt;

&lt;p&gt;These terms are the OAuth 2.0 roles, which are the entities in an OAuth 2.0 flow. The steps taken to get the access token are the OAuth flows.&lt;/p&gt;

&lt;h2&gt;
  
  
  OAuth 2.0 Flows
&lt;/h2&gt;

&lt;p&gt;OAuth 2.0 flows, also known as grant types, specify how a client application can get an access token to access protected resources on behalf of a user. The choice of flow depends on factors like client type and the desired level of security. Let's provide a comprehensive explanation of OAuth flows in simple terms and discuss when to use them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of OAuth 2.0 flows include the following:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Authorization Code Flow:&lt;/strong&gt;&lt;br&gt;
Scenario: Imagine you're a GitHub user, and you want to use a code editing website. When you click "Sign in with GitHub" on the code editor's site, it redirects you to GitHub's login page. After logging in, GitHub provides an authorization code to the code editor, allowing it to access your GitHub account on your behalf.&lt;/p&gt;

&lt;p&gt;Authorization code flow works as the standard for Single Sign-On (SSO). When you log in to one service (e.g., GitHub), it provides an authorization code to a relying party (e.g., a website). This code allows the website to access your identity and log you in without needing a separate login.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When to use:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Used for web applications and confidential clients.&lt;/p&gt;

&lt;p&gt;It involves the exchange of an authorization code for an access token.&lt;/p&gt;

&lt;p&gt;Provides a secure way to authenticate users and obtain access tokens.&lt;/p&gt;

&lt;p&gt;This flow can be used in mobile apps using the Proof Key for Code Exchange (PKCE) technique.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Implicit Flow:&lt;/em&gt;&lt;br&gt;
Scenario: You're building a personal blog and you want to display a list of your public GitHub repositories on it. You add a widget to your blog that fetches this information from GitHub. There's no need for you or your blog visitors to log in or provide GitHub credentials.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;When to use:&lt;/em&gt;&lt;br&gt;
An access token is obtained without an authorization code exchange.&lt;/p&gt;

&lt;p&gt;Use this flow when you want to access publicly available information from GitHub.&lt;/p&gt;

&lt;p&gt;It's ideal for displaying your open-source projects on a website.&lt;/p&gt;

&lt;p&gt;Designed for single-page applications (SPAs) and mobile apps&lt;/p&gt;

&lt;p&gt;Generally used for less sensitive applications due to reduced security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client Credential Flow:&lt;/strong&gt;&lt;br&gt;
Scenario: Think of a situation where a bank's ATM (application) needs to access the bank's cash vault (protected resource) to restock cash. The ATM has its access card (client credentials) to open the vault without involving a bank teller (user).&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;When to use:&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Used for machine-to-machine communication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource Owner Password Credentials Flow (ROPC):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scenario: As a GitHub user who's using a command-line tool to manage your repositories, you can use your GitHub username and password directly with the tool to access your account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This flow is suitable for personal scripts or trusted applications.&lt;/p&gt;

&lt;p&gt;Allows clients to collect and use the user's username and password.&lt;/p&gt;

&lt;p&gt;Considered less secure and should be used sparingly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refresh Token Flow:&lt;/strong&gt;&lt;br&gt;
Scenario: Imagine you're using a GitHub mobile app, and you've logged in. After some time, your session expires, but you don't want to enter your credentials again. The app quietly uses a "refresh token" to get a new access token without bothering you with the login process.&lt;/p&gt;

&lt;p&gt;Refresh token flow enhances SSO by allowing users to stay signed in for extended periods without requiring frequent logins.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used to get a new access token using a refresh token.&lt;/p&gt;

&lt;p&gt;It's ideal for maintaining user sessions across multiple services without inconvenience.&lt;/p&gt;

&lt;p&gt;Let us explore what we have learned so far by creating our own OAuth app.&lt;/p&gt;
&lt;h2&gt;
  
  
  Implementing OAuth 2.0 in React
&lt;/h2&gt;

&lt;p&gt;In this section, we will learn how to implement the OAuth 2.0 authorization code flow in React using Passport JS. This involves many steps, including setting up a GitHub OAuth app, creating React components, and handling the OAuth flow. I'll guide you through the process step by step and provide code snippets for each part.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/CeedoTech/Auth2app" rel="noopener noreferrer"&gt;Code for this Tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  - &lt;a href="https://github.com/settings/developers" rel="noopener noreferrer"&gt;GitHub Account&lt;/a&gt;
&lt;/h2&gt;
&lt;h2&gt;
  
  
  - &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;Node js&lt;/a&gt;(npm)
&lt;/h2&gt;
&lt;h2&gt;
  
  
  - Basic Knowledge of React and JavaScript
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Proxy Server (&lt;a href="https://expressjs.com/" rel="noopener noreferrer"&gt;Express js&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We will build this app using GitHub as our authorization server and the Authorization Code Flow.&lt;/p&gt;
&lt;h3&gt;
  
  
  Getting the GitHub Client ID and Client Secret
&lt;/h3&gt;

&lt;p&gt;Client ID and Client Secret are essential components of the OAuth 2.0 flow for interacting with the authorization server to get the authorization code. To obtain a GitHub client ID and client secret, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Sign in to GitHub&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ensure you have a GitHub account or create one if you don't already have it. You'll need this account to create a GitHub application.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Access Developer Settings&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once logged in, go to the &lt;a href="https://github.com/settings/apps" rel="noopener noreferrer"&gt;GitHub developer settings&lt;/a&gt; to create your new OAuth App&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a New OAuth Application&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On the developer settings page, you'll find a menu on the left. Click on "OAuth Apps" under the "Developer applications" section. To create a new OAuth application, click on the "Register a new application" button.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Fill Out the Application Details&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;GitHub will present you with a form where you need to provide details about your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Application name: Give the app a name of your choice. In this example, it's "Auth2App.".&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Homepage URL: Enter the URL of your application's homepage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Application description: Describe the purpose of your application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authorization callback URL: This is the URL where users will be redirected after granting or denying access. It should match the URL where you handle OAuth callbacks in your application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Generate Client ID and a client secret.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once you've filled out the form, click the "Register application" button. GitHub will generate a Client ID and Client Secret for your application. You'll see them displayed on the application's settings page.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Safeguard Your client's Secret&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That’s it. All done copy your client ID and client secret, and save somewhere safe. &lt;/p&gt;
&lt;h3&gt;
  
  
  Setting up the backend
&lt;/h3&gt;

&lt;p&gt;Since we have secured our GitHub Client ID and Secret. Now let’s implement our backend using Node.js, Express framework, and a Node.js middleware authentication library called &lt;a href="https://www.passportjs.org/" rel="noopener noreferrer"&gt;passport.js&lt;/a&gt;. Let’s follow the following steps to get started:&lt;/p&gt;

&lt;p&gt;Create a directory to house our Project, in this example auth2app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;auth2app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create another directory inside it and name it server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;auth2app &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mkdir &lt;/span&gt;server &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initialize our new project inside our server directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the libraries and Packages we need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;express passport passport-github2 cors cookie-session
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new &lt;code&gt;.env&lt;/code&gt; file to secure your Client ID and Secret that was obtained from GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch&lt;/span&gt; .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Environment variables &lt;code&gt;dotenv&lt;/code&gt; help to improve security while coding. You can add it to your &lt;code&gt;gitignore&lt;/code&gt; file to prevent it from uploading along with other source codes.&lt;/p&gt;

&lt;p&gt;Then, add the Client ID and Secret. The content of the &lt;code&gt;.env&lt;/code&gt; should look as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CLIENT_ID = "Input your Id here";
CLIENT_SECRET = "Input your Secret here";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, create a file where the &lt;code&gt;passport.js&lt;/code&gt; strategies code will be stored:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;passport.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add The following code to your &lt;code&gt;passport.js&lt;/code&gt; file, to update all our variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dotenv&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;config&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;passport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;passport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;GithubStrategy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;passport-github2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;Strategy&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//Input your client id and client secret.&lt;/span&gt;
&lt;span class="nx"&gt;GITHUB_CLIENT_ID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CLIENT_ID&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;GITHUB_CLIENT_SECRET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;CLIENT_SECRET&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import your desired &lt;code&gt;passport.js&lt;/code&gt; strategy from the &lt;a href="https://www.passportjs.org/packages/passport-github2/" rel="noopener noreferrer"&gt;Passport.js&lt;/a&gt; website. Here we are using the GitHub 2 strategy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;passport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;GithubStrategy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="na"&gt;clientID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;GITHUB_CLIENT_ID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;clientSecret&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;GITHUB_CLIENT_SECRET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;callbackURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/auth/github/callback&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;refreshToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nf"&gt;done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now since we using sessions and cookies, we have to serialize and deserialize the user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;passport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;serializeUser&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)});&lt;/span&gt;
&lt;span class="nx"&gt;passport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deserializeUser&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;done&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now Let's Create our express route file named &lt;code&gt;auth.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;auth.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add The following code to your &lt;code&gt;auth.js&lt;/code&gt; file, to declare all variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nc"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;passport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;passport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CLIENT_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:3000/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, we will start adding endpoints for different tasks. Add the &lt;code&gt;/github&lt;/code&gt; endpoint to authenticate the user using passport:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/github&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="nx"&gt;passport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authenticate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;github&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;profile&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; 
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add another endpoint to set our Callback function. This will include Redirect if authentication is successful and Redirect if authentication is unsuccessful:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/github/callback&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="nx"&gt;passport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authenticate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;github&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="na"&gt;successRedirect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;CLIENT_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;failureRedirect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/login/failed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since we don’t have an endpoint for &lt;code&gt;/login/failed&lt;/code&gt;. Add this code to create a &lt;code&gt;/login/failed&lt;/code&gt; endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/login/failed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;success&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Failed to Authenticate&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since we have created the &lt;code&gt;/login/failed&lt;/code&gt;. We will also have to create a &lt;code&gt;/login/success&lt;/code&gt; endpoint. Here we used an if statement to check if the user is authenticated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/login/success&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;success&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Successful&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then add the &lt;code&gt;/logout&lt;/code&gt; endpoint, this helps a user to log out from a session:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/logout&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;logout&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;CLIENT_URL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, we need to export our router:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;router&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now Let's Create our main JS file named &lt;code&gt;index.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add The following code to your &lt;code&gt;index.js&lt;/code&gt; file, to declare all our variables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cookieSession&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cookie-session&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cors&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//From Passport.js file&lt;/span&gt;
&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./passport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;passport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;passport&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//From auth.js file&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;authRoute&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./auth&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="c1"&gt;//Initialize a new Express app&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And add the following middlewares to set cookies, initialize passport, resolve CORS(configuration) and our authRoutes endpoint(/auth).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="nf"&gt;cookieSession&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;session&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;OAuthapp&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="na"&gt;maxAge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;  &lt;span class="mi"&gt;60&lt;/span&gt;  &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;passport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;passport&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;session&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="nf"&gt;cors&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="na"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:3000&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET,POST,PUT,DELETE&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/auth&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;authRoute&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Implementing the React Frontend**
&lt;/h2&gt;

&lt;p&gt;Go to the auth2app directory and bootstrap a new React project using Create React App:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-react-app client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the libraries and Packages we need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;react-router-dom
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the&lt;code&gt;App.css&lt;/code&gt; file in the src directory of your React project and add the following CSS code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.navbar&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-around&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.list&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;list-style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.listItem&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nc"&gt;.login-text&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;margin-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.avatar&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;32px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;32px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;object-fit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;cover&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.login&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;center&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will help to style the navbar component, the Dashboard, and the Home ‘Login with GitHub’ button.&lt;/p&gt;

&lt;p&gt;Update your&lt;code&gt;App.js&lt;/code&gt; file to import the necessary methods and hooks by adding the following code just above the App component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Navbar&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./components/Navbar&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./app.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BrowserRouter&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-router-dom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following Navbar component just before the App component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Navbar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:5000/auth/logout&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;_self&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;navbar&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Link&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blank&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;logo.png&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;25&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;150&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;semaphore logo&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Link&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ul&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;li&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;listItem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;photos&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;""&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;avatar&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/li&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;li&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;listItem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/li&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;li&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;listItem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;logout&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nx"&gt;Logout&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/li&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ul&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Login&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we passed ‘user’ as a prop so we can use it in our code. We simply used the the conditional ternary operator with the syntax : &lt;code&gt;user ? &amp;lt;dashorboard&amp;gt;:&amp;lt;login&amp;gt;&lt;/code&gt;. This simply states if there is a user, display some of the user details and the logout button, If there is no user available it will simply display login.&lt;/p&gt;

&lt;p&gt;Finally, update the App component with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:5000/auth/login/success&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;GET&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;include&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="na"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Access-Control-Allow-Credentials&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;authentication has been failed!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resObject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nf"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resObject&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nf"&gt;getUser&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;BrowserRouter&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Navbar&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;center&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/b&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;displayName&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;UserName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/b&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="na"&gt;Email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/b&amp;gt; {user.emails&lt;/span&gt;&lt;span class="se"&gt;[&lt;/span&gt;&lt;span class="sr"&gt;0&lt;/span&gt;&lt;span class="se"&gt;]&lt;/span&gt;&lt;span class="sr"&gt;.value&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;photos&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;100px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;100px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/center&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;500&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;login.png&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:5000/auth/github&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;_self&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);}}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/BrowserRouter&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we used React useEffect Hook to request our &lt;code&gt;login/success&lt;/code&gt; endpoint that we created in our backend server.&lt;/p&gt;

&lt;p&gt;Now, it's time to test out the implementation. Go to your server directory and run the following command to start up the server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open another terminal in your client directory and run this command to start our React app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will open up &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; in your default browser.&lt;/p&gt;

&lt;p&gt;If you click on the Continue with GitHub button, you'll be redirected to the OAuth consent screen.&lt;/p&gt;

&lt;p&gt;After you're redirected, you'll be logged in and authorized to access the post resources.&lt;/p&gt;

&lt;p&gt;That’s it! Congratulations!🎉 You are done with the tutorial and have learned how to implement OAuth 2.0 authorization code flow in React using Passport JS. Great work!&lt;/p&gt;

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

&lt;p&gt;OAuth 2.0 is a powerful tool for building secure and user-friendly web applications. With a solid understanding and practical code examples at your disposal, you can confidently implement modern authentication and authorization in your projects. You can implement different strategies with passport.js, some of which include Google, Facebook, BitKeep, and many more, using the example laid out for you. Keep security and usability in mind, and your applications will thrive in today's digital landscape.&lt;/p&gt;

</description>
      <category>authentication</category>
      <category>oauth</category>
    </item>
    <item>
      <title>Deploying a React application to GitHub Pages</title>
      <dc:creator>Ifechukwu Obiezue Emmanuel</dc:creator>
      <pubDate>Tue, 13 Aug 2024 02:35:31 +0000</pubDate>
      <link>https://dev.to/ifechukwuobiezue/deploying-a-react-application-to-github-3ipm</link>
      <guid>https://dev.to/ifechukwuobiezue/deploying-a-react-application-to-github-3ipm</guid>
      <description>&lt;p&gt;Deploying a React application to &lt;a href="https://pages.github.com/" rel="noopener noreferrer"&gt;GitHub Pages&lt;/a&gt; is a popular and straightforward way to host your static projects for free. GitHub Pages provides a convenient platform for sharing your work with others, whether it's a personal project, portfolio, or documentation site. Here's a step-by-step guide to deploying your React application to GitHub Pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before you begin, ensure that you have the following:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Node.js and npm&lt;/strong&gt;: Ensure that Node.js and npm are installed on your machine. You can check this by running &lt;code&gt;node -v&lt;/code&gt; and &lt;code&gt;npm -v&lt;/code&gt; in your terminal.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;React Application&lt;/strong&gt;: You should have an existing React application created using &lt;code&gt;create-react-app&lt;/code&gt; or a similar setup.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GitHub Repository&lt;/strong&gt;: A GitHub account with a repository where you want to deploy your React application. The repository can be either public or private.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Step 1: Install &lt;code&gt;gh-pages&lt;/code&gt; Package
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;gh-pages&lt;/code&gt; package makes it easy to deploy your React application to GitHub Pages. Install it by running the following command in your React project's root directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; gh-pages
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Update &lt;code&gt;package.json&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;To automate the deployment process, you need to add a few fields to your &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add the homepage field&lt;/strong&gt;: This specifies the URL of your GitHub Pages site. Replace &lt;code&gt;username&lt;/code&gt; and &lt;code&gt;repository-name&lt;/code&gt; with your GitHub username and repository name, respectively.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="nl"&gt;"homepage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://username.github.io/repository-name"&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add predeploy and deploy scripts&lt;/strong&gt;: These scripts will help you build and deploy your application with a single command.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"predeploy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npm run build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="nl"&gt;"deploy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gh-pages -d build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
     &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;other&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;scripts&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;predeploy&lt;/code&gt;: Runs the &lt;code&gt;build&lt;/code&gt; script before deploying the app.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;deploy&lt;/code&gt;: Uses &lt;code&gt;gh-pages&lt;/code&gt; to publish the contents of the &lt;code&gt;build&lt;/code&gt; directory to the &lt;code&gt;gh-pages&lt;/code&gt; branch of your repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: Build Your Application
&lt;/h3&gt;

&lt;p&gt;Run the &lt;code&gt;predeploy&lt;/code&gt; script to build your application. This will generate an optimized production build in the &lt;code&gt;build&lt;/code&gt; directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Deploy to GitHub Pages
&lt;/h3&gt;

&lt;p&gt;Deploy your application by running the &lt;code&gt;deploy&lt;/code&gt; script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will create or update the &lt;code&gt;gh-pages&lt;/code&gt; branch in your repository and push the contents of the &lt;code&gt;build&lt;/code&gt; directory to that branch. GitHub Pages will automatically serve your site from this branch.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Access Your Deployed Site
&lt;/h3&gt;

&lt;p&gt;Once the deployment is complete, you can access your site at the URL specified in the &lt;code&gt;homepage&lt;/code&gt; field of your &lt;code&gt;package.json&lt;/code&gt; file. It typically takes a few minutes for the site to become available.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Custom Domain (Optional)
&lt;/h3&gt;

&lt;p&gt;If you want to use a custom domain, create a &lt;code&gt;CNAME&lt;/code&gt; file in the &lt;code&gt;public&lt;/code&gt; directory of your React project and add your domain name (e.g., &lt;code&gt;www.example.com&lt;/code&gt;). GitHub Pages will configure your custom domain automatically when you deploy your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Troubleshooting Tips
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;404 Errors&lt;/strong&gt;: If your React app uses client-side routing (e.g., with React Router), you may encounter 404 errors when navigating directly to a route. To fix this, create a &lt;code&gt;404.html&lt;/code&gt; file in your &lt;code&gt;public&lt;/code&gt; directory with the following content:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;   &lt;span class="nt"&gt;&amp;lt;script&amp;gt;&lt;/span&gt;
     &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/repository-name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cache Issues&lt;/strong&gt;: Sometimes, GitHub Pages may cache old versions of your site. To resolve this, try clearing your browser cache or appending a query string (e.g., &lt;code&gt;?v=1&lt;/code&gt;) to the URL.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Deploying a React application to GitHub Pages is a simple and effective way to showcase your work. By following these steps, you can have your project live in just a few minutes. GitHub Pages is an excellent choice for hosting static sites, and with the help of the &lt;code&gt;gh-pages&lt;/code&gt; package, the deployment process is smooth and hassle-free.&lt;/p&gt;

</description>
      <category>github</category>
    </item>
    <item>
      <title>How to Create a New Project and Push to GitHub from your Local Machine</title>
      <dc:creator>Ifechukwu Obiezue Emmanuel</dc:creator>
      <pubDate>Sat, 30 Mar 2024 00:00:08 +0000</pubDate>
      <link>https://dev.to/ifechukwuobiezue/how-to-create-a-new-project-and-push-to-github-from-your-local-machine-20gl</link>
      <guid>https://dev.to/ifechukwuobiezue/how-to-create-a-new-project-and-push-to-github-from-your-local-machine-20gl</guid>
      <description>&lt;p&gt;This is something we already know how to do, but for reference sake am documenting this here.&lt;/p&gt;

&lt;p&gt;To create a new project and push it to GitHub from your local machine, you'll need to follow these general steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install Git:&lt;/strong&gt; If you haven't already, download and install Git on your local machine. You can get it from the official Git website: &lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;https://git-scm.com/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a New Repository on GitHub:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log in to your GitHub account.&lt;/li&gt;
&lt;li&gt;Click on the "+" sign in the top right corner of the page.&lt;/li&gt;
&lt;li&gt;Select "New repository."&lt;/li&gt;
&lt;li&gt;Enter a name for your repository, add a description if you want, and choose any other settings you need (public or private, initialize with a README, etc.).&lt;/li&gt;
&lt;li&gt;Click on the "Create repository" button.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Set up Git on Your Local Machine:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open a terminal or command prompt on your local machine.&lt;/li&gt;
&lt;li&gt;Configure Git with your name and email address:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git config --global user.name "Your Name"
 git config --global user.email "your_email@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Navigate to Your Project Directory:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;cd&lt;/code&gt; command to navigate to the directory where you want to create your project.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Initialize a Git Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;git init&lt;/code&gt; to initialize a new Git repository in your project directory.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Add Your Files to the Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy or create the files you want to include in your project into the repository directory.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;git add .&lt;/code&gt; to add all files in the current directory to the staging area. You can also specify individual files instead of &lt;code&gt;.&lt;/code&gt; to add only specific files.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Commit Your Changes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After adding files to the staging area, commit them to the repository with a commit message:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git commit -m "Initial commit"
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Link Your Local Repository to GitHub:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On GitHub, copy the URL of your repository (should look like &lt;code&gt;https://github.com/username/repository-name.git&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Back in your terminal, add the remote repository URL using:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git remote add origin https://github.com/username/repository-name.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Push Your Changes to GitHub:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, push your committed changes to the GitHub repository:
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;If you are using a different branch name, replace &lt;code&gt;master&lt;/code&gt; with your branch name.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Authenticate with GitHub:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;If prompted, enter your GitHub username and password or token to authenticate and push your changes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After completing these steps, your project files should be successfully pushed to GitHub, and you can view them in your GitHub repository online.&lt;/p&gt;

&lt;p&gt;⚡Feel free to reference back to this guide at any time.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Steps to Become a Profitable Trader</title>
      <dc:creator>Ifechukwu Obiezue Emmanuel</dc:creator>
      <pubDate>Sat, 29 Apr 2023 16:29:58 +0000</pubDate>
      <link>https://dev.to/ifechukwuobiezue/steps-to-become-a-profitable-trader-ldh</link>
      <guid>https://dev.to/ifechukwuobiezue/steps-to-become-a-profitable-trader-ldh</guid>
      <description>&lt;p&gt;In the trading world today, many various strategies are being discussed in the trading market for becoming profitable, but the Essential keys in become profitable in the trading space all boil down to technical analysis and trading phycology.&lt;/p&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%2F0csgvu9ew98g1za9h5l3.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%2F0csgvu9ew98g1za9h5l3.jpg" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Understanding the technical aspect of trading takes quite a while to be able to master efficiently, In the world today there consist of various technical strategies, like the trendline (breakout and retest), the indicators, the Fibonacci, Price action and more. All these are various strategies used by most profitable and successful traders, but the one I prefer and find the most efficient is price action. The reason is because the market moves with time and price and it is constantly evolving, in this case, the knowledge of price action helps you by being up to date on the current market situations.&lt;/p&gt;

&lt;p&gt;To fully understand price action, you first have to let go of all other strategies you have on your sleeves to avoid misapprehensions before we continue, price action simply refers to understanding the demand and supply in the market, this also comes with various strategies like the smart money concept(SMC), Institutional concept of trading(ICT), Wykoff method, etc. All these are various ways in which demand and supply are utilized efficiently.&lt;/p&gt;

&lt;p&gt;To efficiently grasp this technique, you need to have the basics of candlesticks anatomy, knowing when a candle opens and close, knowing the high and low of the candle, and knowing the order flow of the market.&lt;/p&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%2Fuqjjm6m5dqw6iztkpoci.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%2Fuqjjm6m5dqw6iztkpoci.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In other words, knowing your market structure more efficiently makes you a step ahead in becoming profitable in this trading space. Now let's talk about Trading psychology.&lt;/p&gt;

&lt;p&gt;Trading Psychology refers to the emotions and mental state that help dictate success or failure in trading, it involves your mindset when trading and when you’re not trading. Discipline and risk management are two of the most critical aspects of trading psychology since the implementation of these is critical to a successful and effective Trading Plan.&lt;/p&gt;

&lt;p&gt;A consistently profitable trader specializes in one or two strategies he/she focuses on trading those flawlessly. To be a Profitable trader you must first set your mindset that trading is not a rich quick scheme, it’s a steady business whose keyword is “consistency”, you must start small and expunge every atom of greed. For a trader not to be greedy, you must enjoy the little profit you’re making, for example, if you are making 5$ in a day the compound interest in a month will be at approximately 150$. Another aspect of trading psychology is Fear. The fear of loss, no one likes to lose money. But unfortunately, losses are part of the Trading World which must set a mindset on how to approach it, for example before I consider taking a trade I must check and set my risk-to-reward ratio.&lt;/p&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%2Ft3frmzteuf35gmbc0e8d.PNG" 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%2Ft3frmzteuf35gmbc0e8d.PNG" alt="Image description" width="800" height="399"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The highlighted part of the image is the value of the risk-to-reward ratio of a trade which is the target divided by the stop&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In other to approach fear in trading you must risk what you can afford to lose and try not to open too many orders at once.&lt;/p&gt;

&lt;h1&gt;
  
  
  NEXT CHAPTER WILL BE ON HOW TO USE THE PRICE ACTION STRATEGY AND MAKE AN ENTRY...stay TUNNED!
&lt;/h1&gt;

</description>
      <category>crypto</category>
      <category>cryptocurrency</category>
      <category>trading</category>
      <category>forex</category>
    </item>
  </channel>
</rss>
