<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bali Chowdry on Medium]]></title>
        <description><![CDATA[Stories by Bali Chowdry on Medium]]></description>
        <link>https://medium.com/@balichowdry?source=rss-56a75ae386b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*SZXf2BMpX1gOe_5TLup-cQ.png</url>
            <title>Stories by Bali Chowdry on Medium</title>
            <link>https://medium.com/@balichowdry?source=rss-56a75ae386b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 20:46:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@balichowdry/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Leveraging AI Tools to Revolutionize Development Productivity]]></title>
            <link>https://medium.com/@balichowdry/leveraging-ai-tools-to-revolutionize-development-productivity-ffef8dab2e25?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffef8dab2e25</guid>
            <category><![CDATA[turbo-charger-development]]></category>
            <category><![CDATA[cursor-ai]]></category>
            <category><![CDATA[ai-development-company]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 08:07:56 GMT</pubDate>
            <atom:updated>2025-02-12T11:06:23.189Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkKjfoT8L1Fu3-bFAoXoSg.png" /><figcaption>The Future of Software Development: AI-Powered Tools You Need to Know</figcaption></figure><p>In recent years, Artificial Intelligence (AI) has transcended from a buzzword to a practical catalyst for productivity and innovation in software development. DPL is embracing this technological wave with an ambitious goal: to ensure every employee leverages an AI agent or tool to optimize their function.</p><p><strong>The implementation of AI tools in SDLC has shifted the way teams work by reducing the time taken to complete the projects, improving delivery speed, increasing code quality, and making the software development life cycle more efficient. We have integrated different AI-enabled systems in <em>DPL</em> to improve efficiency and productivity while enabling effective and streamlined development processes. A glance of how these tools are changing the way we conduct daily business.</strong></p><p>Here’s how AI tools are transforming our development process and enabling us to deliver faster solutions.</p><h4><strong>Turbocharge Everything Using Cursor AI</strong></h4><p>One of the standout tools we’ve integrated into our workflow is Cursor AI, which significantly improves code assistance.</p><p><strong>Auto-Completion &amp; Suggestions:</strong> <br>Cursor AI helps our developers quickly write React Native components by reducing boilerplate code and minimizing common syntax errors. It’s like having a coding companion that understands your intent and guides you to write cleaner, more efficient code.</p><p><strong>Error Detection:</strong> <br>Real-time error detection is a game-changer. Cursor AI identifies issues such as incorrect props, invalid state handling, and missing imports, reducing the time spent on debugging and enhancing overall code quality.</p><h4>Accelerating Development Velocity</h4><p><strong>Boilerplate Generation:</strong> <br>Time-consuming repetitive tasks like navigation setup, Redux slices, and styled-components are no longer bottlenecks. Cursor AI automatically generates these structures, enabling developers to focus on core functionality.</p><p><strong>Code Scaffolding:</strong> <br>Need a new component, hook, or screen? Cursor AI’s scaffolding capabilities provide ready-made templates, further reducing development time and ensuring project consistency.</p><h4>Smarter Debugging with Codium and AI</h4><p>Debugging and testing are integral parts of our development cycle. Tools like Codium, along with ChatGPT/DeepSeek and GitHub Copilot, streamline these processes:</p><ul><li><strong>Unit Testing with Codium:</strong> Writing and maintaining unit tests is easier with AI-assisted suggestions, ensuring robust and reliable codebases.</li><li><strong>AI-Assisted Debugging:</strong> ChatGPT/DeepSeek although DeepSeek gives better results in some cases and GitHub Copilot provides instant recommendations to fix issues, from syntax errors to complex logical bugs, saving hours of manual troubleshooting.</li></ul><h4>Optimizing PR Reviews with Code Aunt AI</h4><p>For code reviews, we use <strong>Code Aunt AI</strong>, which:</p><ul><li>Automatically detects potential issues or optimizations in pull requests.</li><li>Provides actionable insights to ensure code quality.</li><li>Accelerates the review process, enabling faster feature delivery.</li></ul><h4>QA Automation with Katalon</h4><p>Quality assurance is another area where AI has made a significant impact. <strong>Katalon</strong> is our go-to tool for QA automation due to its:</p><ul><li>Seamless integration with popular SDKs like Firebase, AWS, and Supabase.</li><li>Capable of generating test scripts for mobile and web applications from the UI.</li><li>Support for data mocking and API mocking, ensuring comprehensive test coverage.</li></ul><h4>AI in DevOps and Infrastructure</h4><p>AI also plays a pivotal role in our DevOps and infrastructure processes:</p><ul><li><strong>Infrastructure as Code:</strong> Tools like Pulumi and Terraform, combined with AI assistance, simplify complex scripting tasks.</li><li><strong>DevOps Automation:</strong> From CI/CD pipelines to environment provisioning, AI tools enhance reliability and speed.</li></ul><h3>Where Cursor AI Gives Maximum Output</h3><h4>1. Code Assistance &amp; Development Speed</h4><p>✅ <strong>Frontend (Mobile &amp; Web)</strong></p><ul><li>Works well for <strong>React Native and React</strong> by suggesting auto-completion, reducing boilerplate, and speeding up UI development.</li><li><strong>Scaffolding Components, Hooks, and Screens</strong> save time, especially for common patterns like navigation, authentication, and forms.</li><li>Good at generating <strong>basic animations</strong> and UI interactions.</li></ul><p>✅ <strong>Backend Development</strong></p><ul><li>Efficient in writing <strong>boilerplate for APIs (REST/GraphQL)</strong>, including request handling and controllers.</li><li>Can assist in <strong>database modeling (MongoDB, PostgreSQL, MySQL)</strong>.</li><li>Useful for generating <strong>Lambda functions, Express routes, or NestJS services</strong>.</li></ul><p>✅ <strong>Cloud &amp; DevOps</strong></p><ul><li>Great at <strong>refactoring cloud functions</strong> and <strong>infrastructure as code (IaC)</strong> using Pulumi or Terraform.</li><li>Works well with <strong>Firebase, AWS (Lambda, DynamoDB, S3), and Supabase</strong> integrations.</li><li>Can generate scripts for <strong>CI/CD pipelines, Dockerfiles, and Kubernetes manifests</strong>.</li></ul><p>✅ <strong>Data Mocking &amp; API Testing</strong></p><ul><li>Can generate <strong>realistic API responses</strong> and <strong>mock data</strong> for front-end testing.</li><li>Helps in <strong>unit and integration test cases</strong> using Jest, Mocha, or Cypress.</li></ul><h3>Where Cursor AI Will NOT Help Much</h3><h4>1. Complex Business Logic &amp; Large Codebases</h4><p>❌ <strong>Mobile &amp; Web Apps</strong></p><ul><li>Struggles with understanding <strong>deeply interconnected components</strong> (e.g., advanced Redux/MobX state management).</li><li>Cannot effectively <strong>debug complex async flows (e.g., background services, push notifications, deep linking issues in React Native)</strong>.</li></ul><p>❌ <strong>Backend Development</strong></p><ul><li>Does not fully understand <strong>business-specific logic</strong> in large microservices-based applications.</li><li>May generate <strong>generic security implementations</strong> that don’t align with custom enterprise policies.</li></ul><h4>2. Advanced React Native &amp; Web Performance Optimization</h4><p>❌ <strong>Performance Bottlenecks</strong></p><ul><li>Cannot accurately <strong>profile and fix UI rendering lags, Re-animated performance issues, or large list virtualization (FlatList, RecyclerListView)</strong>.</li><li>Struggles to optimize <strong>GPU-intensive animations or custom native modules</strong>.</li></ul><h4>3. Third-Party SDKs &amp; Custom Native Modules</h4><p>❌ <strong>Limited Support for Libraries</strong></p><ul><li>May not fully support or optimize complex third-party integrations like <strong>React Navigation, Reanimated, VisionCamera, or Lottie</strong>.</li><li>Cannot generate <strong>efficient TypeScript typings for complex APIs</strong>.</li></ul><p>❌ <strong>Custom Native Modules</strong></p><ul><li>Struggles with <strong>bridging iOS (Objective-C/Swift) and Android (Kotlin/Java) modules</strong> for React Native.</li><li>Cannot effectively debug <strong>JNI issues, memory leaks, or native crashes</strong>.</li></ul><h4>4. Security, Privacy, and Compliance Risks</h4><p>❌ <strong>Cloud-Based Processing Risks</strong></p><ul><li>If code is sent to the cloud for processing, it could expose <strong>sensitive business logic, API keys, or authentication flows</strong>.</li><li>Verifying <strong>compliance with GDPR, SOC 2, or internal security policies is necessary</strong>.</li></ul><h3>Final Verdict</h3><p>✅ <strong>Best Use Cases</strong></p><ul><li>Rapid prototyping and UI scaffolding.</li><li>Backend API generation and DevOps scripting.</li><li>Cloud function refactoring (AWS, Firebase, Supabase).</li><li>Code reviews and debugging common syntax issues.</li><li>Data and API mocking for frontend testing.</li></ul><p>❌ <strong>Where It Falls Short</strong></p><ul><li>Optimizing performance for <strong>highly interactive, animation-heavy mobile apps</strong>.</li><li>Understanding <strong>deep state management flows in complex web apps</strong>.</li><li>Debugging <strong>low-level native integrations in React Native</strong>.</li><li>Handling <strong>enterprise-scale security and compliance concerns</strong>.</li></ul><h4>The Era of AI-Driven Productivity</h4><p>We are living in a truly transformative time. Perhaps the most radical we’ve witnessed in our professional and business careers. Research shows that tools like Cursor AI can increase a software engineer’s velocity by up to <strong>400%</strong>. That’s not just impressive — it’s revolutionary.</p><p>Imagine the possibilities when this advantage is passed on to our clients. Faster feature rollouts, higher-quality products, and cost efficiencies become the new standard.</p><p>Our vision is clear: Starting with software engineers, every employee will integrate AI into their workflow to amplify their impact. The future of development isn’t just about writing code; it’s about using AI to innovate, automate, and accelerate every aspect of the process.</p><p>Let’s build this future together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ffef8dab2e25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevSecOps]]></title>
            <link>https://medium.com/@balichowdry/devsecops-1932fe2988ff?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1932fe2988ff</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[devsecops]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Mon, 06 May 2024 09:22:56 GMT</pubDate>
            <atom:updated>2024-05-06T09:26:35.134Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lFvQRcOtBBjU3DYeljbeFg.png" /></figure><p><strong>Security Guideline</strong> <br>Security Guidelines for Mobile, Web, and Backend we need to follow</p><p><a href="https://owasp.org/www-project-top-ten/">OWASP Top Ten Web Application Security Risks | OWASP Foundation</a></p><p><a href="https://owasp.org/www-project-mobile-app-security/">https://owasp.org/www-project-mobile-app-security/</a> <br><a href="https://owasp.org/www-project-application-security-verification-standard/">https://owasp.org/www-project-application-security-verification-standard/</a></p><p><a href="https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines">https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines</a></p><p><a href="https://owasp.org/www-pdf-archive/OWASP_SCP_Quick_Reference_Guide_v2.pdf">https://owasp.org/www-pdf-archive/OWASP_SCP_Quick_Reference_Guide_v2.pdf</a> <br><a href="https://owasp.org/www-project-proactive-controls/">https://owasp.org/www-project-proactive-controls/</a></p><p><strong>Our Approach</strong> <br>We want to automate our security practices that involve the integration of security at every phase of the SDLC, from initial design through integration, testing, deployment, and software delivery.</p><p><strong>DevSecOps<em> (Development, Security, and Operations)</em></strong></p><p>represents a natural and necessary evolution in the way development organizations approach security. It outlines why having a DevSecops approach not only makes the software more secure but also why it can speed up the development process.</p><p><strong>DevSecOps</strong> is a way of approaching IT security with an “everyone is responsible for security” mindset. It involves injecting security practices into an organization’s DevOps pipeline. The goal is to incorporate security into <em>all</em> stages of the software development workflow. That’s contradictory to its predecessor development models — DevSecOps means you’re not saving security for the final stages of the SDLC.</p><p>To begin with, you need to understand the following key concepts in DecSecOps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GrxOlJ0Q66xcJoINomnO0g.png" /></figure><ul><li><strong>Security as Code:</strong> This involves incorporating security into the code itself, using tools like Static Application Security Testing (SAST) and Dynamic Application Security Testing (DAST).</li><li><strong>Threat Modeling:</strong> This involves identifying potential threats and vulnerabilities in the application and creating a plan to mitigate them.</li><li><strong>Security Testing:</strong> This involves running regular security tests to identify vulnerabilities in the application.</li></ul><p>With a gist of the basics of DecSecOps, you can begin by integrating security into your existing CI/CD pipeline. This can involve adding security testing tools like SAST and DAST to your pipeline, as well as conducting regular threat modeling exercises.</p><p>We also need to look at compliance frameworks like HIPAA, PCI DSS, and GDPR, which are essential for organizations that handle sensitive data.</p><p><strong>Shift Left</strong></p><p>The shift-left testing approach means baking security into your applications at the very beginning, instead of waiting until the final stages of the delivery chain. The obvious advantage of doing this is you can identify potential vulnerabilities and work on resolving them sooner. And the earlier you find any bugs, the cheaper it will be for you to fix them. So it’s a great practice, but it does come with its fair share of complications.</p><p><strong>Code</strong></p><p>Developers can run DevSecOps in the code phase to guide them write better secure programs. Code-phase security practices include pre-commit hooks, static code analysis, and code reviews.</p><p>Security technologies are involved in developers’ existing Git workflow.</p><p>When a security test automates triggers every commit and merge. It even supports combined development and programming languages. Security code tools such as CheckStyle, PMD, Gerrit, Phabricator, Find Security Bugs, and SpotBugs are the most popular.</p><p><strong>DAST &amp; SAST</strong></p><p><strong>DAST</strong> (Dynamic Application Security Testing) tools are automated security testing tools used to detect potential vulnerabilities in running web applications. They actively interact with an application by sending requests and analyzing the responses.DAST scans are typically used for compliance and detecting vulnerabilities in production running applications.</p><p><strong>SAST</strong> (<strong>Static Application Security Testing</strong>) tools are automated security testing tools used to detect potential vulnerabilities in <strong>the source code of applications</strong> before they become operational.</p><p>They are typically used to identify security flaws at the early stages of development, which helps to reduce the cost and time associated with fixing a vulnerability that has already been deployed.</p><p>Since<strong> OWASP Zap</strong> is a <strong>DAST</strong> tool that only works when your code is deployed and running, it should be the second step.</p><p>The first step to protect your application is static code analysis which you can easily do with Codiga.</p><p><strong>Codiga</strong> is a <strong>SAST</strong> tool. Its core feature is to automatically perform source code analysis, which ultimately scans your code base against the <a href="https://www.codiga.io/blog/owasp-10/">OWASP 10</a> and major vulnerabilities.</p><p>It can help you in many ways:</p><ul><li>Security focus (OWASP 10, MITRE CWE, CWE Top 25)</li><li>Static code analysis with ease</li><li>Web version with the features of snippets management</li><li>Git Hooks can trigger errors against any vulnerability while pushing the code to the repository.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hPsmFDxGaYMRbfFO6O_bNw.png" /><figcaption>codiga</figcaption></figure><p><a href="https://www.codiga.io/static-code-analysis/">Static Code Analysis in your IDE and CI/CD pipeline</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wd7CI3KMdUupqJ7xtPCsOQ.png" /></figure><p><strong>Test</strong></p><p>The test phase starts after a build artifact is built and deployed to testing conditions or staging. Executing a complete test suite requires a significant amount of time. Therefore, this phase should fail quickly to complete the more costly test jobs later.</p><p>During the test phase, <strong>DAST</strong> tools are used to detect actual application flows such as SQL injection, authorization, user authentication, API-related endpoints, and SQL injection. There are multiple paid testing and open-source tools available in the current market, including Gauntlet, Arachi, Boofuzz, JBroFuzz, BDD Automated Security Tests, Owasp Zap, SecApp suite, and IBM AppScan.</p><p><strong>Release</strong></p><p>Test the application and executable code when the DevSecOps cycle reaches the release phase. The phase explores the configuration variables such as network firewall access, personal data management, and user access control to secure the runtime architecture.</p><p>Configuration management technologies are essential for security during the release phase. It allows visibility into the static configuration of a dynamic environment. <a href="https://www.veritis.com/services/terraform/">Terraform</a>, <a href="https://www.veritis.com/blog/chef-vs-puppet-vs-ansible-comparison-of-devops-management-tools/">Puppet, Chef, Ansible</a>, and <a href="https://www.veritis.com/services/docker/">Docker</a> are configuration management tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ihedqTYObd0naCVEKShX1A.png" /></figure><p><strong>Tools</strong></p><p><a href="https://www.zaproxy.org/">ZAP Proxy Scanner</a></p><p><a href="https://www.iriusrisk.com/community">Iriusrisk for Threat Model</a></p><p><a href="https://about.gitlab.com/solutions/">https://about.gitlab.com/solutions/</a></p><p><a href="https://www.breachlock.com/">https://www.breachlock.com/</a></p><p><a href="https://github.com/projectdiscovery/nuclei-action">https://github.com/projectdiscovery/nuclei-action</a></p><p><a href="https://www.codiga.io/static-code-analysis/">https://www.codiga.io/static-code-analysis/</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#dependency-management">Dependency Management</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#dynamic-analysis">Dynamic Analysis</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#infrastructure-as-code-analysis">Infrastructure as Code Analysis</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#intentionally-vulnerable-applications">Intentionally Vulnerable Applications</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#monitoring">Monitoring</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#secrets-management">Secrets Management</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#secrets-scanning">Secrets Scanning</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#static-analysis">Static Analysis</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#supply-chain-security">Supply Chain Security</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#threat-modelling">Threat Modelling</a></p><p><a href="https://github.com/TaptuIT/awesome-devsecops#related-lists">https://github.com/TaptuIT/awesome-devsecops#related-lists</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1932fe2988ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing REST APIs: Advanced Authentication and Authorization Strategies]]></title>
            <link>https://medium.com/@balichowdry/securing-rest-apis-advanced-authentication-and-authorization-strategies-11374350c337?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/11374350c337</guid>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[sso-single-sign-on-portal]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Mon, 06 May 2024 09:12:03 GMT</pubDate>
            <atom:updated>2024-05-06T09:12:03.819Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Securing REST APIs: Advanced Authentication and Authorization Strategies</strong></p><p>In today’s digital world, security is of the utmost importance, and API security is no exception. When building RESTful APIs, it’s essential to implement advanced authentication and authorization strategies to protect sensitive data and ensure that only authorized users have access to your API. We will discuss some advanced authentication and authorization techniques we can use to secure your REST APIs.</p><p><strong>What is Authorization?</strong></p><p>Authorization, not to be confused with Authentication, occurs after a system has successfully verified the identity of an entity. The system will then allow access to resources such as information, files, databases, or specific operations and capabilities. After a system authenticates a user, authorization verifies access to the required resources. It is the process of determining whether an authenticated user can access a particular resource or perform a specific action.</p><p>For example, after a file server authenticates a user, it can check which files or directories that can be read, written, or deleted. This is where authorization comes into play.</p><p><strong>Why Is User Authorization Important?</strong></p><p>User authorization help protect Software as a Service (SaaS) applications and services by ensuring users have the right permissions. It enables organizations to control and secure access to sensitive databases, private and personal data, and corporate resources.</p><p>Organizations typically implement a granular authorization structure that does not grant flat access to all resources. Instead, different organizational roles are assigned access to the resources relevant to their job. This access control practice is called the least privilege principle, and it guides many organizations in protecting their resources from unauthorized access.</p><p>Restricting access to resources helps protect critical data like intellectual property, medical records, consumers’ identities, and payroll information. It ensures users have access only to resources required for their role, minimizing the potential damage if a threat actor compromises the account. It also helps employees quickly find resources and information without sifting through all company documents and folders.</p><p><strong>Types of Authorization</strong></p><ul><li>Discretionary Access Control (DAC)‍ — DAC determines privileges depending on the specific user and their access groups. A DAC model allows every object in a system to be accessed by a particular group or identity. Those in charge of granting authorization can provide admin permission to other users.</li><li>Mandatory Access Control (MAC) — MAC determines the authorization of entities at the operating system level. MAC commonly governs permissions for threads and processes, defining which files and memory objects they can access.</li><li>Role-Based Access Control (RBAC) — RBAC is used to enforce access controls defined in the DAC or MAC model. RBAC builds on predefined roles and privileges, assigns users to roles, and configures a system so that only specific roles can access each object.</li><li>Attribute-based Access Control (ABAC) — ABAC is used to enforce access controls in a policy-based manner. It uses attributes, that can be attached to a user, a resource, an object, or an entire environment. An entity is authorized if the authentication system finds that all the attributes defined in the policy are true.</li></ul><p><strong>Common standards and methods</strong></p><ul><li>Authorization is typically performed using OAuth 2.0 and may involve methods like Role-Based Access Control (RBAC) and Attribute-Based Access Control (ABAC)</li></ul><p><strong>What is Authentication?</strong></p><p>Authentication is verifying the true identity of a user or entity, while authorization determines what a user can access and ensures that a user or entity receives the right access or permissions in a system. Authentication is a prerequisite to authorization.</p><p>Authentication helps ensure that only authorized users can gain access to protected resources on the network level. Limited access may include networks, ports, hosts, and other services.</p><p>Authentication is the process of verifying that a user is who they claim to be. For example, when you go through security at an airport, you show your ID to authenticate your identity.</p><p><strong>Why Is User Authentication Important?</strong></p><p>User authentication enables you to verify the identity of any user attempting to access the corporate network or computing resource. Authentication helps organizations ensure that only authorized users access protected resources. It prevents unauthorized entities from accessing and potentially stealing information, damaging systems, or causing various problems.</p><p>The authentication process authorizes a human-to-machine credentials transfer during interactions on a certain network to confirm the user’s identity. Human-to-computer interactions perform user authentication to authorize access on wired and wireless networks to enable access to networked and internet-connected systems and resources.</p><p>User authentication should not be confused with machine authentication, a different process that automates authentication and does not require user input. Common examples include automatically logged-in and guest accounts that do not require user input.</p><p><strong>Types of Authentication</strong></p><ul><li>Passwords — considered “old school” and less secure but are still commonly used in almost all authentication schemes.</li><li>One-time Password (OTP )‍ — grants a user or device one-time access to a system. Authentication systems can deliver an OTP via email, text message, or a physical access token.</li><li>Token authentication — grants access to a user or device based on an access token they possess. The token can be a hardware device or a software token passed to their browser from an identity provider. Learn more in our detailed guide to <a href="https://frontegg.com/blog/token-based-authentication">Token-Based Authentication</a>.</li><li>Single Sign-on (SSO) ‍ — enables login to multiple applications via a central identity provider. The identity provider can be a service with a large user base, such as Google or Facebook, or an organizational identity provider, such as Active Directory. Learn more in our detailed guide to <a href="https://frontegg.com/blog/a-complete-guide-to-implementing-single-sign-on">SSO Authentication</a>.</li><li>Biometric authentication — uses an inherence factor, such as the user’s face or fingerprint to identify them. There are increasingly sophisticated ways to compare a photo or scan of a person’s biological traits with a database of known identities.</li><li>Multi-Factor Authentication (MFA)‍ — This methodology combines multiple forms of authentication to improve security. Typically, an MFA scheme will augment passwords with token-based authentication, OTP, biometric authentication, or several of these.</li><li>Passwordless authentication — This is basically a variation on MFA, which uses two authentication factors including fingerprints, magic links, or OTAs to authenticate users without a password.</li></ul><p><strong>Common standards and methods</strong></p><ul><li>Authentiction is typically performed using Basic Authentication, API Key, OpenID Connect, HMAC, JWT Authentication</li></ul><p><strong>OAuth 2.0</strong></p><p>OAuth 2.0 is an authorization framework that enables third-party applications to obtain limited access to a user’s resources on a server. OAuth 2.0 is widely used for securing REST APIs, as it allows clients to access resources on behalf of users without exposing their credentials.</p><p><strong>Understanding OAuth 2.0 Flows</strong></p><p>OAuth 2.0 defines several flows or “grant types” to support various client types and use cases:</p><ol><li>Authorization Code: This flow is suitable for server-side applications, where the client application can securely store the client secret. It involves redirecting users to an authorization server to obtain an authorization code, which can then be exchanged for an access token.</li><li>Implicit: This flow is designed for client-side applications (e.g., single-page applications) where the client secret cannot be securely stored. In this flow, the authorization server directly returns an access token instead of an authorization code.</li><li>Resource Owner Password Credentials: This flow allows users to provide their credentials directly to the client application, which then exchanges them for an access token. This flow is suitable for trusted applications only.</li><li>Client Credentials: This flow is used when the client application needs to access resources on its own behalf, not on behalf of a user. The client application authenticates with the authorization server and receives an access token directly.</li></ol><p><strong>Implementing OAuth 2.0</strong></p><p>To implement OAuth 2.0, you’ll need to register your application with an OAuth 2.0 provider (e.g., Google, Facebook, or your custom provider) to obtain a client ID and secret. Once registered, you can use one of the flows mentioned above to obtain an access token for accessing the REST API.</p><p>Here’s a simple example using the authorization code flow in a Node.js application with the Express framework:</p><pre>const express = require(&#39;express&#39;);<br>const request = require(&#39;request&#39;);<br>const querystring = require(&#39;querystring&#39;);<br>const app = express();<br>// Configuration<br>const clientId = &#39;your_client_id&#39;;<br>const clientSecret = &#39;your_client_secret&#39;;<br>const redirectUri = &#39;http://localhost:3000/callback&#39;;<br>const authServer = &#39;https://your_auth_server.com&#39;;<br>// Routes<br>app.get(&#39;/authorize&#39;, (req, res) =&gt; {<br>const authUrl = `${authServer}/authorize?client_id=${clientId}&amp;redirect_uri=${redirectUri}&amp;response_type=code`;<br>res.redirect(authUrl);<br>});<br>app.get(&#39;/callback&#39;, (req, res) =&gt; {<br>const code = req.query.code;<br>const tokenRequestOptions = {<br>method: &#39;POST&#39;,<br>url: `${authServer}/token`,<br>headers: {<br>&#39;Content-Type&#39;: &#39;application/x-www-form-urlencoded&#39;,<br>},<br>auth: {<br>user: clientId,<br>pass: clientSecret,<br>},<br>body: querystring.stringify({<br>grant_type: &#39;authorization_code&#39;,<br>code: code,<br>redirect_uri: redirectUri,<br>}),<br>};<br>request(tokenRequestOptions, (error, response, body) =&gt; {<br>if (!error &amp;&amp; response.statusCode == 200) {<br>const accessToken = JSON.parse(body).access_token;<br>// // Use the access token to access the protected REST API resources<br>// …<br>res.send(&#39;Access token obtained: &#39; + accessToken);<br>} else {<br>res.status(400).send(&#39;Error obtaining access token&#39;);<br>}<br>});<br>});<br>app.listen(3000, () =&gt; console.log(&#39;OAuth 2.0 example app listening on port 3000!&#39;));</pre><p>In this example, the /authorize route redirects users to the authorization server to obtain an authorization code. The /callback route handles the authorization server’s response and exchanges the authorization code for an access token, which can then be used to access protected resources.</p><p><strong>JSON Web Tokens (JWT)</strong></p><p>JSON Web Tokens (JWT) is a compact, URL-safe token format used to represent claims to be transferred between two parties. JWTs are often used for authentication and authorization in REST APIs. A JWT consists of three parts: a header, a payload, and a signature.</p><p><strong>JWT Authentication</strong></p><p>JWT authentication involves the following steps:</p><ol><li>The client sends their credentials (e.g., username and password) to the server.</li><li>The server verifies the credentials and, if valid, generates a JWT and returns it to the client.</li><li>The client stores the JWT and sends it in the Authorization header with each subsequent request.</li><li>The server validates the JWT and grants access to the protected resources if the token is valid.</li></ol><p>Here’s an example of implementing JWT authentication in a Node.js application with the Express framework and the JSON web token library:</p><pre>const express = require(&#39;express&#39;);<br>const jwt = require(&#39;jsonwebtoken&#39;);<br>const app = express();<br>// Configuration<br>const secret = &#39;your_secret_key&#39;;<br>// Middleware for checking JWT<br>function verifyToken(req, res, next) {<br>const token = req.headers[&#39;authorization&#39;]?.split(&#39; &#39;)[1];<br>if (!token) {<br>return res.status(403).send(&#39;No token provided&#39;);<br>}<br>jwt.verify(token, secret, (err, decoded) =&gt; {<br>if (err) {<br>return res.status(401).send(&#39;Invalid token&#39;);<br>}<br>req.userId = decoded.id;<br>next();<br>});<br>}<br>// Routes<br>app.post(&#39;/login&#39;, (req, res) =&gt; {<br>// Validate credentials (e.g., check against a database)<br>// …<br>// If the credentials are valid, generate a JWT<br>const token = jwt.sign({ id: &#39;example_user_id&#39; }, secret, { expiresIn: &#39;1h&#39; });<br>res.json({ token });<br>});<br>app.get(&#39;/protected&#39;, verifyToken, (req, res) =&gt; {<br>res.send(&#39;This is a protected resource accessible only with a valid token&#39;);<br>});<br>app.listen(3000, () =&gt; console.log(&#39;JWT example app listening on port 3000!&#39;));</pre><p>In this example, the /login route generates a JWT if the provided credentials are valid. The /protected route uses the verifyToken middleware to check for a valid JWT before granting access to the protected resource.</p><p><strong>OpenID Connect</strong> <br> <br>OpenID Connect is an open authentication protocol built on top of the OAuth 2.0 protocol. It enables clients to verify the identity of an end user based on the authentication performed by an authorization server. OpenID Connect uses JWTs called ID tokens to represent user information.</p><p>To implement OpenID Connect, you’ll need to register your application with an OpenID Connect provider (e.g., Google, Facebook, or your own custom provider) to obtain a client ID and secret. You’ll also need to use an OAuth 2.0 flow to obtain an ID token alongside the access token.</p><p>Here’s a simple example of implementing OpenID Connect in a Node.js application with the Express framework:</p><p>// …// …</p><p>// This example assumes you’ve already implemented the OAuth 2.0 Authorization Code flow</p><p>// as shown in the previous section.</p><p>// …</p><pre>const jwt = require(&#39;jsonwebtoken&#39;);<br>// Configuration<br>const openidConfig = {<br>issuer: &#39;https://your_openid_connect_provider.com&#39;,<br>jwksUri: &#39;https://your_openid_connect_provider.com/jwks&#39;,<br>};<br>// Function to fetch the public key for JWT verification<br>function fetchPublicKey(kid, callback) {<br>request({ url: openidConfig.jwksUri, json: true }, (error, response, body) =&gt; {<br>if (!error &amp;&amp; response.statusCode === 200) {<br>const jwk = body.keys.find((key) =&gt; key.kid === kid);<br>const publicKey = jwk &amp;&amp; jwk.x5c &amp;&amp; jwk.x5c[0];<br>callback(null, publicKey);<br>} else {<br>callback(error);<br>}<br>});<br>}<br>// Middleware for checking ID token<br>function verifyIdToken(req, res, next) {<br>const idToken = req.headers[&#39;authorization&#39;]?.split(&#39; &#39;)[1];<br>if (!idToken) {<br>return res.status(403).send(&#39;No ID token provided&#39;);<br>}<br>jwt.verify(idToken, fetchPublicKey, { issuer: openidConfig.issuer }, (err, decoded) =&gt; {<br>if (err) {<br>return res.status(401).send(&#39;Invalid ID token&#39;);<br>}<br>req.userId = decoded.sub;<br>next();<br>});<br>}<br>// Routes<br>app.get(&#39;/protected&#39;, verifyIdToken, (req, res) =&gt; {<br>res.send(&#39;This is a protected resource accessible only with a valid ID token&#39;);<br>});<br>app.listen(3000, () =&gt; console.log(&#39;OpenID Connect example app listening on port 3000!&#39;));</pre><p>In this example, the /protected route uses the verifyIdToken middleware to check for a valid ID token before granting access to the protected resource. The fetchPublicKey function retrieves the public key from the OpenID Connect provider’s JWKS endpoint to verify the ID token’s signature.</p><p><strong>Role-Based Access Control (RBAC)</strong></p><p>Role-Based Access Control (RBAC) is a method for controlling access to resources based on the roles assigned to individual users. In the context of REST APIs, you can use RBAC to restrict access to specific endpoints or data based on the user’s role.</p><p>Here’s an example of implementing RBAC in a Node.js application with the Express framework:</p><pre>const express = require(&#39;express&#39;);<br>const app = express();<br>// Mock user data (in a real application, this data would come from a database)<br>const users = [<br>{ id: 1, username: &#39;user1&#39;, role: &#39;admin&#39; },<br>{ id: 2, username: &#39;user2&#39;, role: &#39;user&#39; },<br>];<br>// Middleware for checking roles<br>function checkRole(role) {<br>return (req, res, next) =&gt; {<br>const user = users.find((user) =&gt; user.id === req.userId);<br>if (!user || user.role !== role) {<br>return res.status(403).send(&#39;Forbidden&#39;);<br>}<br>next();<br>};<br>}<br>// Routes<br>app.get(&#39;/admin&#39;, checkRole(&#39;admin&#39;), (req, res) =&gt; {<br>res.send(&#39;This is an admin-only resource&#39;);<br>});<br>app.get(&#39;/user&#39;, checkRole(&#39;user&#39;), (req, res) =&gt; {<br>res.send(&#39;This is a user-only resource&#39;);<br>});<br>app.listen(3000, () =&gt; console.log(&#39;RBAC example app listening on port 3000!&#39;));</pre><p>In this example, the checkRole middleware is used to restrict access to the /admin and /user routes based on the user’s role. The middleware checks if the user’s role matches the required role before granting access to the protected resource. Note that this example assumes we have already implemented some form of authentication (e.g., JWT or OAuth 2.0) and stored the authenticated user’s ID in req.userId.</p><p><strong>Our Strategy for Rest API</strong></p><p>We can combine RBAC with other authentication and authorization techniques (e.g., OAuth 2.0, JWT, or OpenID Connect) to provide even more robust security for your REST APIs.</p><p><strong>Use OAuth 2.0 with JWT</strong></p><p>We will use JSON Web Token (JWT) format for the access token &amp; refresh token mechanism. Implementing an Auth standard like OAuth 2.0 ensures proper authentication because the user’s identity is validated, unlike API keys, where only the application’s identity is validated.</p><p><strong>For complex applications</strong> with multiple users, I would recommend using OIDC. It’s more secure and widely adopted.OIDC allows individuals to use <a href="https://www.pingidentity.com/en/resources/identity-fundamentals/authentication/single-sign-on.html">single sign-on (SSO)</a> to access relying party sites using OpenID Providers (OPs), such as an email provider or social network, to authenticate their identities.</p><p><strong>For web applications only</strong>, I would recommend using Token-based authentication with the precautions stated above.</p><p><strong>SAML</strong> is your best bet if you are building an enterprise application, but sometimes it can be a bit much to handle.</p><p><strong>WebAuthn</strong> is another great option for web applications, but it’s still in its early stages and not widely adopted yet. and it introduces one new challenge — what if the user loses the authenticator.</p><p><strong>In my opinion, you can’t go wrong</strong> with OAuth/OIDC. It’s a bit more complex than some other options, especially for smaller applications, but it’s secure and widely adopted.</p><p><strong>Password Policy</strong></p><p>Passwords are the first line of defense against unauthorized access to API endpoints. To ensure that passwords are secure, they should be complex, unique, and stored in a secure manner. Password policies such as password expiration and complexity requirements can help enforce these best practices.</p><p><strong>Validate User Input</strong></p><p>Input validation is essential to prevent injection attacks such as SQL injection and cross-site scripting (XSS). By validating user input, you can ensure that API requests contain only expected data types and values, preventing malicious input from executing unauthorized code or accessing sensitive data.</p><p><strong>Limit Rate and Access</strong></p><p>Limiting the rate and access of API requests can help prevent denial-of-service (DoS) attacks and protect against unauthorized access. By implementing rate-limiting and throttling, you can ensure that API resources are used efficiently and effectively.</p><p><strong>Role-Based Access Control (RBAC) </strong><br>RBAC is used to enforce access controls defined in the DAC or MAC model. RBAC builds on predefined roles and privileges, assigns users to roles, and configures a system so that only specific roles can access each object.</p><p><strong>Leveraging encryption</strong></p><p>Encryption is used to keep database credentials, REST API authentication details, or other sensitive data secure.</p><p>This helps us to eliminate several risk vectors, including hacks, data breaches, or malicious access to our business-critical data.</p><p><strong>Logging &amp; Monitoring</strong></p><p>Finally, API logging and then who is accessing our technical resources, alongside how and when, is critical for maintaining the security of all kinds of solutions — including those that rely on external API requests.</p><p>Regular auditing of our automation logs and user behavior ensures that we can identify new threats, unauthorized data access, or other critical security risks before they escalate and result in more serious outcomes.</p><p><strong>Advanced(use-case base)</strong></p><p><strong>Implement two-factor authentication</strong></p><p>Two-factor authentication (2FA) is an advanced security measure that adds an extra layer of protection to your REST API. It requires the user to provide a second form of identification, such as a code sent to their mobile phone or a biometric identifier, in addition to their username and password. By implementing 2FA, you can ensure that only authorized users are granted access to your sensitive API resources.</p><p>2FA significantly reduces the risk of account compromise by making it much harder for attackers to gain access to your API. Even if an attacker manages to steal a user’s password, they will still need to provide the second factor of authentication to access your API. This makes it much more difficult for attackers to gain unauthorized access to your API resources, even if they have stolen a user’s password.</p><p><strong>Use API gateways</strong></p><p><a href="https://blog.stoplight.io/api-proxy-vs-api-gateway-c008c942a02d">API gateways</a> are another advanced security measure that can help enhance the security of your REST API. An API gateway acts as a mediator between the client and API endpoints, allowing you to enforce security policies and apply additional security measures such as rate-limiting, caching, and monitoring. By using an API gateway, you can centralize API security management and reduce the risk of unauthorized access.</p><p>API gateways provide several benefits for REST API security. They allow you to implement security policies such as authentication and authorization at a single location, simplifying the management of your API security. They also provide additional security features such as rate-limiting and caching, which can help prevent attacks such as DDoS and improve API performance.</p><p>By using an API gateway, you can also implement monitoring and logging, providing valuable insights into how your API is being used and identifying potential security threats. Overall, API gateways are a powerful tool for enhancing the security of your REST API, allowing you to implement security policies and apply additional security measures in a centralized manner.</p><p><strong>Implement threat modeling</strong></p><p>Threat modeling is an advanced security practice that involves systematically analyzing the attack surface of your REST API and identifying potential security threats. By proactively identifying and mitigating potential threats, you can significantly enhance the security of your API.</p><p>The first step in threat modeling is to identify the assets that are most valuable to your API, such as sensitive data or critical functionality. Once you have identified your assets, you can then identify potential threats and vulnerabilities that could be used to compromise them. This could include attacks such as SQL injection, cross-site scripting, or API enumeration attacks.</p><p>Once you have identified potential threats, you can then prioritize mitigation measures to address them. This could include implementing additional security measures such as authentication and authorization, input validation, and rate-limiting. By proactively identifying and mitigating potential threats, you can significantly enhance the security of your REST API and reduce the risk of successful attacks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11374350c337" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD Pipeline Mobile]]></title>
            <link>https://medium.com/@balichowdry/ci-cd-pipeline-mobile-5312fa95542c?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5312fa95542c</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[fastlane]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Mon, 06 May 2024 09:02:41 GMT</pubDate>
            <atom:updated>2024-05-06T09:02:41.370Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>CI/CD Pipeline Mobile</strong></p><p>Setting up a Continuous Integration/Continuous Deployment (CI/CD) pipeline for mobile development involves automating the process of building, testing, and deploying your mobile applications. Here’s a detailed explanation of how you can set up such a pipeline:</p><p><strong>Version Control System (VCS):</strong></p><ul><li>Start by using a version control system like Git to manage your mobile app’s source code. Host your repository on platforms like GitHub, GitLab, or Bitbucket.</li></ul><p><strong>CI/CD Platform Selection:</strong></p><ul><li>Choose a CI/CD platform that supports mobile development. Some popular options include Jenkins, GitLab CI/CD, Travis CI, CircleCI, and Azure DevOps.</li></ul><p><strong>Define Workflow:</strong></p><ul><li>Define the workflow of your CI/CD pipeline. Typically, it includes stages such as:</li><li>Build: Compile the source code and generate the binary.</li><li>Test: Run automated tests to ensure the quality of the code.</li><li>Deploy: Distribute the built artifact to designated environments (e.g., staging, production).</li></ul><p><strong>Build Stage:</strong></p><ul><li>Set up a script to build your mobile app. For Android, you’ll use Gradle, and for iOS, you’ll use Xcode’s build tools. Ensure that the necessary dependencies are installed.</li><li>Use build tools to generate the APK (Android) or IPA (iOS) file.</li><li>Store the generated artifacts in a location accessible to subsequent stages.</li></ul><p><strong>Test Stage:</strong></p><ul><li>Configure automated tests for your mobile app. This can include unit tests, integration tests, and UI tests.</li><li>For Android, you can use tools like Espresso or Robolectric. For iOS, you can use XCTest or third-party frameworks like Appium.</li><li>Integrate code coverage tools to measure test coverage.</li><li>Set up emulators/simulators or real devices for testing.</li><li>If tests fail, halt the pipeline and notify the team.</li></ul><p><strong>Deploy Stage:</strong></p><ul><li>Define deployment targets for your mobile app, such as app stores (Google Play Store, Apple App Store), internal distribution platforms, or over-the-air (OTA) distribution services.</li><li>Automate the deployment process using deployment scripts or built-in integrations with app store APIs.</li><li>Ensure that the deployment process adheres to security best practices, such as code signing and app permissions.</li></ul><p><strong>Pipeline Configuration:</strong></p><ul><li>Configure your CI/CD platform to trigger the pipeline on code commits or pull requests.</li><li>Define environment variables and secrets required for the pipeline stages (e.g., API keys, signing certificates).</li><li>Set up notifications to alert team members of pipeline status changes (e.g., Slack, email).</li></ul><p><strong>Monitoring and Feedback:</strong></p><ul><li>Monitor the performance and stability of your CI/CD pipeline.</li><li>Collect metrics such as build duration, test coverage, and deployment frequency.</li><li>Gather feedback from developers and stakeholders to continuously improve the pipeline.</li></ul><p><strong>Iterate and Improve:</strong></p><ul><li>Regularly review and refine your CI/CD pipeline to optimize efficiency and reliability.</li><li>Incorporate feedback from team members and adapt to changes in the mobile development landscape.</li><li>Experiment with new tools and techniques to enhance the automation process</li></ul><p>let’s delve deeper into the implementation details of a CI/CD pipeline for mobile development:</p><ul><li>Setting up a CI/CD Platform:</li><li>Choose a CI/CD platform that suits your needs. For example, if you’re using GitLab:</li><li>Go to your GitLab project and navigate to Settings &gt; CI/CD.</li><li>Enable CI/CD pipelines.</li><li>Optionally, configure pipeline triggers (e.g., triggers on commits, merge requests).</li><li>GitLab CI/CD uses a file called .gitlab-ci.yml to define the pipeline configuration.</li></ul><p><strong>Defining the Pipeline Stages:</strong></p><ul><li>Inside your .gitlab-ci.yml file, define stages for your pipeline. Each stage represents a logical group of tasks. Example stages for mobile development might include build, test, and deploy.</li></ul><p><strong>Build Stage Implementation:</strong></p><ul><li>In the build stage, you&#39;ll compile your mobile app&#39;s source code and generate the binary.</li><li>For Android:</li><li>Use Gradle to build the project and generate the APK.</li><li>Example .gitlab-ci.yml snippet for Android:</li></ul><pre>stages:<br>  - build<br>build_android:<br>  stage: build<br>  script:<br>    - ./gradlew assembleDebug<br>  artifacts:<br>    paths:<br>      - app/build/outputs/apk/debug/app-debug.apk</pre><p>For iOS:</p><ul><li>Use Xcode’s build tools (xcodebuild) to build the project and generate the IPA.</li><li>Example .gitlab-ci.yml snippet for iOS:</li></ul><pre>stages:<br>  - build<br>build_ios:<br>  stage: build<br>  script:<br>    - xcodebuild -workspace YourApp.xcworkspace -scheme YourScheme -configuration Release -destination &#39;generic/platform=iOS&#39; clean archive -archivePath build/YourApp.xcarchive<br>    - xcodebuild -exportArchive -archivePath build/YourApp.xcarchive -exportOptionsPlist exportOptions.plist -exportPath build<br>  artifacts:<br>    paths:<br>      - build/YourApp.ipa</pre><p><strong>Test Stage Implementation:</strong></p><ul><li>In the test stage, you&#39;ll run automated tests to ensure the quality of your code.</li><li>Configure test suites for Android and iOS using respective testing frameworks (e.g., Espresso, XCTest).</li><li>Run tests on emulators/simulators or real devices.</li><li>Example .gitlab-ci.yml snippet for running Android tests</li></ul><pre>stages:<br>  - test<br>test_android:<br>  stage: test<br>  script:<br>    - ./gradlew test</pre><pre>stages:<br>  - test<br>test_ios:<br>  stage: test<br>  script:<br>    - xcodebuild -workspace YourApp.xcworkspace -scheme YourScheme -configuration Debug -destination &#39;platform=iOS Simulator,name=iPhone 12&#39; test</pre><p><strong>Deploy Stage Implementation:</strong></p><ul><li>In the deploy stage, you&#39;ll distribute the built artifacts to designated environments.</li><li>Define deployment targets such as app stores or internal distribution platforms.</li><li>Use deployment scripts or built-in integrations to automate the deployment process.</li><li>Example .gitlab-ci.yml snippet for deploying to Firebase App Distribution:</li></ul><pre>stages:<br>  - deploy<br>deploy_android:<br>  stage: deploy<br>  script:<br>    - curl -sL https://firebase.tools | bash<br>    - firebase appdistribution:distribute app/build/outputs/apk/debug/app-debug.apk --app your-firebase-app-id --token $FIREBASE_TOKEN<br>  only:<br>    - master</pre><p><strong>Pipeline Configuration:</strong></p><ul><li>Configure pipeline triggers, variables, and secrets in your CI/CD platform’s settings.</li><li>Set up notifications to alert team members of pipeline status changes.</li></ul><p><strong>Testing and Iteration:</strong></p><ul><li>Test your pipeline by pushing code changes and observing the pipeline execution.</li><li>Gather feedback from team members and stakeholders to identify areas for improvement.</li><li>Iterate your pipeline configuration to optimize efficiency and reliability.</li></ul><p>By following these implementation steps, you can establish a robust CI/CD pipeline for mobile development, automating key tasks such as building, testing, and deploying your mobile applications with ease.</p><p><strong>Fastlane</strong></p><p>Fastlane is a popular tool for automating the deployment process of iOS and Android apps. It provides a set of actions to streamline tasks such as building, testing, and releasing apps. One of its functionalities includes managing certificates and provisioning profiles for iOS development. Here’s how you can use Fastlane to create certificates:</p><p><strong>Install Fastlane:<br></strong> Before you begin, make sure you have Fastlane installed on your system. You can install it using RubyGems:</p><p>Fastlane is a popular tool for automating the deployment process of iOS and Android apps. It provides a set of actions to streamline tasks such as building, testing, and releasing apps. One of its functionalities includes managing certificates and provisioning profiles for iOS development. Here’s how you can use Fastlane to create certificates:</p><ol><li>Install Fastlane: Before you begin, make sure you have Fastlane installed on your system. You can install it using RubyGems:</li></ol><pre>sudo gem install fastlane -NV</pre><p>initialize Fastlane: If you haven’t set up Fastlane in your project yet, navigate to your project directory and run:</p><pre>fastlane init</pre><p>Follow the prompts to set up Fastlane for your project. This will create a fastlane directory with configuration files.</p><p>Create Certificates: Fastlane provides a built-in action called cert for managing certificates. Run the following command to create a new certificate:</p><pre>fastlane run cert</pre><p>This command will guide you through the process of generating a new certificate. It will prompt you to provide your Apple Developer account credentials and select the type of certificate you want to create (e.g., Development, Production). Follow the instructions to complete the certificate creation process.</p><p>Automate Certificate Renewal: To automate the renewal of certificates, you can integrate Fastlane into your CI/CD pipeline. Create a Fastfile in your fastlane directory and define a lane for certificate renewal. For example:</p><pre>lane :renew_certificates do<br>  cert(<br>    development: true, # Renew development certificates<br>    output_path: &quot;./certs&quot;, # Output path for generated certificates<br>    username: &quot;your@appleid.com&quot; # Your Apple Developer account email<br>  )<br>end</pre><p>You can then run this lane as part of your CI/CD pipeline to automatically renew certificates when needed.</p><p><strong>Additional Configuration:</strong></p><ul><li>You can customize the certificate generation process by providing additional options to the cert action. Refer to the Fastlane documentation for a list of available options.</li><li>Ensure that your Apple Developer account has the necessary permissions to manage certificates.</li></ul><p>By using Fastlane to manage certificates, you can simplify the process of handling code signing tasks for iOS development, reducing manual effort and ensuring consistency across your development team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5312fa95542c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Push Notification with FCM (High-Level Architecture) & Key Considerations]]></title>
            <link>https://medium.com/@balichowdry/push-notification-with-fcm-high-level-architecture-key-considerations-df60369307c0?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/df60369307c0</guid>
            <category><![CDATA[push-notification]]></category>
            <category><![CDATA[reactnativeappdevelopment]]></category>
            <category><![CDATA[fcm-push-notification]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Fri, 16 Feb 2024 05:44:25 GMT</pubDate>
            <atom:updated>2024-02-16T06:03:12.324Z</atom:updated>
            <content:encoded><![CDATA[<p>Firebase Cloud Messaging (FCM) is a popular cloud solution for messages on iOS, Android, and web applications. Implementing push notifications with FCM involves several steps.</p><h3>High-level flow Diagram</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SAEqPgTmtd5F2QaqauwiCQ.png" /></figure><p><strong>Permission Handling: (Mobile Side)</strong></p><ul><li>Use react-native-permissions to prompt users for notification permissions.</li><li>Obtain the device’s registration token using react-native-firebase after receiving permission.</li></ul><p><strong>FCM Token Management:</strong></p><ul><li>FCM token is generated by the FCM SDK or HTTP API Call to get a unique device token.</li><li>Store FCM tokens in a Devices table in the database.</li><li>Update tokens on events like app launch, uninstall/reinstall, user logout, or token expiration.</li></ul><p><strong>Push Notification Trigger Path:</strong></p><ul><li>Send a POST request to the backend API for push notifications.</li><li>The backend constructs and dispatches notifications using the FCM token of the target user.</li><li>Store dispatched notifications in a Notifications table for future reference.</li></ul><p><strong>Database Data Models:</strong></p><ul><li>Users table with a One → Many relationships with Notifications and Devices.</li><li>Notifications table for storing notification details.</li><li>Devices table for managing FCM tokens, with a Many → One relationship with Users.</li></ul><p><strong>Device Handling:</strong></p><ul><li>Fetch and store the user’s FCM token on application load.</li><li>Mark devices as inactive on user logout, account deletion, or silent notification preferences.</li></ul><p><strong>Notifications Page in the App:</strong></p><ul><li>Fetch and display recent notifications on the Notifications page.</li><li>Update notification state from read to unread via a POST request upon leaving the screen.</li></ul><h3>Steps required</h3><p><strong>Set up Firebase Project:</strong></p><ul><li>Create a Firebase project on the Firebase Console.</li><li>Add your app to the project and download the configuration file (google-services.json for Android, GoogleService-Info.plist for iOS).</li></ul><p><strong>Integrate FCM SDK:</strong></p><ul><li>Add the FCM SDK to your mobile app project.</li><li>For Android, add the SDK using Gradle.</li></ul><pre>implementation &#39;com.google.firebase:firebase-messaging:23.0.0&#39;</pre><p>For iOS, use CocoaPods or manually integrate the SDK.</p><p><strong>Initialize FCM:</strong></p><ul><li>Initialize FCM in your app, usually in the onCreate method for Android or AppDelegate for iOS.</li></ul><p><strong>Register Device for FCM Token:</strong></p><ul><li>Get the FCM token by registering the device with FCM.</li><li>This token uniquely identifies the device and is used to send messages to it.</li></ul><p><strong>Send Token to Your Server:</strong></p><ul><li>Send the FCM token to your server so that it can be used to send push notifications later.</li></ul><p><strong>Handle FCM Messages:</strong></p><ul><li>Implement a service or delegate to handle incoming FCM messages.</li><li>For Android, create a class that extends FirebaseMessagingService.</li><li>For iOS, implement methods in the UNUserNotificationCenterDelegate.</li></ul><p><strong>Handle Click Actions:</strong></p><ul><li>Define what happens when a user clicks on the notification.</li><li>Open a specific activity or screen, or perform a custom action.</li></ul><p><strong>Send Notifications from Server:</strong></p><ul><li>Your server sends requests to the FCM server using the FCM token to push notifications to specific devices.</li></ul><h3><strong>Setup Project in React Native</strong></h3><h4>React Native Firebase Setup:</h4><p>Initialize Your React Native Project</p><pre>npx react-native init YourProjectName cd YourProjectName</pre><p><strong>Install React Native Firebase:</strong></p><pre>npm install @react-native-firebase/app @react-native-firebase/messaging</pre><p><strong>Configure Android and iOS:</strong></p><ul><li>For Android, place the google-services.json file in the android/app directory.</li><li>For iOS, place the GoogleService-Info.plist file in the ios directory.</li></ul><p><strong>Link the Modules:</strong></p><pre>npx react-native link @react-native-firebase/app npx react-native link @react-native-firebase/messaging</pre><p><strong>Initialize Firebase in Your App:</strong></p><p>In your index.js or App.js, initialize Firebase:</p><pre>import { AppRegistry } from &#39;react-native&#39;; <br>import messaging from &#39;@react-native-firebase/messaging&#39;; <br>import App from &#39;./App&#39;; <br>import { name as appName } from &#39;./app.json&#39;;<br><br>// Register background handler <br>messaging().setBackgroundMessageHandler(async remoteMessage =&gt; <br>{<br>console.log(&#39;Message handled in the background!&#39;, remoteMessage); <br>});<br>  AppRegistry.registerComponent(appName, () =&gt; App);</pre><p><strong>Request Permission and Get FCM Token:</strong></p><p>Request permission from the user to receive notifications and get the FCM token:</p><pre>import messaging from &#39;@react-native-firebase/messaging&#39;;<br>// ...  <br>useEffect(() =&gt; {<br>   const requestUserPermission = async () =&gt; {<br>     const authStatus = await messaging().requestPermission();<br>     const enabled = authStatus === messaging.AuthorizationStatus.AUTHORIZED ||       <br>authStatus === messaging.AuthorizationStatus.PROVISIONAL;<br>      if (enabled) {       <br>       const token = await messaging().getToken();<br>       console.log(&#39;FCM Token:&#39;, token);     <br>}   <br>};    <br>requestUserPermission(); }, []);</pre><p><strong>Handle Notifications:</strong></p><p>Handle notifications when the app is in the foreground:</p><pre>import { useEffect } from &#39;react&#39;;<br>import messaging from &#39;@react-native-firebase/messaging&#39;;<br> // ...<br>  useEffect(() =&gt; {   <br>    const unsubscribeOnMessage = messaging().onMessage(async remoteMessage =&gt; {     <br>    console.log(&#39;A new FCM message arrived!&#39;, JSON.stringify(remoteMessage));   <br>});    <br>return () =&gt; {    <br>  unsubscribeOnMessage();   <br>}; <br>}, []);</pre><p>Handle notifications when the app is in the background or terminated in your index.js or App.js:</p><pre>import messaging from &#39;@react-native-firebase/messaging&#39;;<br>  messaging().setBackgroundMessageHandler(async remoteMessage =&gt; {<br>   console.log(&#39;Message handled in the background!&#39;, remoteMessage); <br>});</pre><p><strong>Testing:</strong></p><p>Test your setup by sending a test notification using the Firebase Console or an HTTP request.</p><h3>Additional Notes:</h3><p><strong>Security:</strong></p><ul><li>Use server authentication for secure communication between your server and FCM.</li><li>Ensure your FCM server key is kept confidential.</li></ul><p><strong>Token Refresh:</strong></p><ul><li>FCM tokens can expire or be refreshed. Implement logic to handle token refreshes and update your server accordingly.</li></ul><p><strong>Message Payload:</strong></p><ul><li>Understand the FCM message payload and structure it appropriately.</li><li>The payload can include data, notification title, body, etc.</li></ul><p><strong>Foreground and Background Handling:</strong></p><ul><li>Handle notifications differently based on whether the app is in the foreground or background.</li><li>Foreground messages can be handled directly by your app, while background messages may require a custom notification.</li></ul><p><strong>Testing:</strong></p><ul><li>Test push notifications on both Android and iOS devices.</li><li>Use the Firebase Console or tools like Postman for server testing.</li></ul><p><strong>User Permissions:</strong></p><ul><li>Request and handle user permissions for receiving notifications.</li><li>For iOS, handle user consent using the UNUserNotificationCenterDelegate.</li></ul><p><strong>Rate Limiting:</strong></p><ul><li>Be mindful of FCM’s rate-limiting policies to avoid issues with sending too many messages.</li></ul><p><strong>Error Handling:</strong></p><ul><li>Implement error handling for cases where messages cannot be delivered.</li><li>FCM provides feedback on the status of messages sent.</li></ul><p><strong>Localization:</strong></p><ul><li>Consider localization for notification messages to support users in different regions.</li></ul><p><strong>Analytics:</strong></p><ul><li>Utilize Firebase Analytics to track the effectiveness of your push notifications.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df60369307c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git~~Pull Request & Branching]]></title>
            <link>https://medium.com/@balichowdry/git-pull-request-branching-6c601b4d5a3f?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c601b4d5a3f</guid>
            <category><![CDATA[git-branching-strategy]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[pull-request]]></category>
            <category><![CDATA[git-branch]]></category>
            <category><![CDATA[gitla]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Thu, 09 Nov 2023 09:16:22 GMT</pubDate>
            <atom:updated>2023-11-09T09:16:22.878Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Pull Request / Merge Request</strong></p><p>Code review is essential for protecting your source code from bugs and flaws when developer teams work on projects. For this reason, Git platforms like GitLab use pull requests as the main code-review supporting feature. We’ll explore everything you need to know about working with pull requests in GitLab and how you can adopt this workflow to maintain healthy source code.</p><p><strong>Simple 3 Steps to create a pull request/merge request</strong></p><ol><li>Create a temporary Branch based on the task</li></ol><p>Team members can create and delete these branches whenever it is required.</p><p><strong>Start Name with Category Word</strong></p><p>It is recommended to begin the name of a branch with a <strong>category word</strong>, which indicates the type of task that is being solved with that branch. Some of the most used <strong>category words</strong> are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ZKdN3KgeZrMv03S5NE20g.png" /><figcaption>Branch Category Naming</figcaption></figure><p>With the help of the category word, it is effortless to identify the purpose of the <a href="https://hackernoon.com/git-branches-vgaa3ypm?ref=hackernoon.com">Git branch</a> and attend to it.</p><p>2. Use proper commit messages, with multiple commit messages</p><ul><li>Be Clear and concise</li><li>Relevant Context</li></ul><p><em>Reference: </em><a href="https://gist.github.com/luismts/495d982e8c5b1a0ced4a57cf3d93cf60"><em>Best Practices</em></a></p><p>Create a merge request in GitLab (Our case GitLab)<br>3. You can create a new merge request from the merge request page. Simply navigate your <strong>Menu</strong> &gt; <strong>Projects</strong> &gt; <strong>New merge request</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e_5MgpFD8rgLSlvZ5NHqCw.png" /><figcaption>GitLab merge request</figcaption></figure><p>From here, you can choose the source and target branch. Next, click <strong>Compare branches and continue</strong> and fill out the required fields to create your merge request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bVdwt6Zpm5yL4dOP8Ckybw.png" /><figcaption>Compare branches GitLab</figcaption></figure><p>Once you click Compare branches and continue, Add the Jira Ticket number, and description of what has changed, assign the review (Peer Review / Lead Review), and click Create merge request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tgiVtyWkJXozSTQf_AyNCw.png" /><figcaption>Create Merge Request — GitLab</figcaption></figure><p>If you get comments from the reviewer make the changes accordingly and request for re-review, Once Approved merge it back to the relevant branch.</p><p>Merge requests take time to review. So, a large merge request may be off-putting for reviewers. They’ll need to block off large chunks of time to review big merge requests, which can create unnecessary delays.</p><p>The best way to keep your merge request concise is to address only one concern at a time. Then, consider creating a separate branch &amp; then merge requests for different concerns (Feature, Bugfix, Hotfix)</p><p><strong>Our Branching Strategy</strong><br>I wanted to share a real-time scenario that illustrates our team’s approach to software release management. By adopting this method, we aim to streamline the release process, ensure stability, and maintain clarity throughout our development cycle.</p><p>In our example, we consider a new software release. Here’s a breakdown of our workflow:</p><p><strong>Branch Creation:</strong> We initiate the process by creating a development branch from the master branch. This serves as the primary branch for ongoing development work.</p><p><strong>Feature Integration:</strong> As development progresses, we continuously integrate new features and address bug fixes within the development branch.</p><p><strong>Release Preparation:</strong> When it’s time to prepare for a new software release, we create a dedicated release branch from the development branch. For the sake of this example, let’s call it “release09.11.23 or release-v1.0.0” based on how long your release cycle will take and tag each release candidate</p><p><strong>Testing and Refinement: </strong>The release-09.11.23 branch is where we conduct rigorous testing, perform necessary bug fixes, and finalize documentation. This step ensures the release’s quality and readiness.</p><p><strong>Merging to Master:</strong> Once the release is deemed ready, we merge the release-09.11.23 branch into the master branch. This integration creates a new production release.</p><p><strong>Branch Cleanup:</strong> To maintain clarity and streamline ongoing development, we deleted the release-09.11.23 branch. Development work then resumes on the development branch.</p><p>The overarching goal of this approach is to isolate release management tasks from ongoing development, thereby preserving the stability of the master branch. Typically, our release branches are derived from the development branch (or “develop” branch) since it contains the most up-to-date features and changes.</p><p>This workflow is particularly beneficial when dealing with extended-release cycles, allowing us to effectively monitor and track the progress of each release while safeguarding the master branch’s stability.</p><p>If you have any questions or would like further details about this process, please feel free to reach out. We believe that a well-defined software release management strategy is vital for maintaining the quality and reliability of our software.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c601b4d5a3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smart waste management using IoT]]></title>
            <link>https://medium.com/@balichowdry/smart-waste-management-using-iot-9452b818aeec?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9452b818aeec</guid>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[sustainability]]></category>
            <category><![CDATA[smart-dustbin]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Thu, 09 Nov 2023 07:04:43 GMT</pubDate>
            <atom:updated>2023-11-09T09:44:41.913Z</atom:updated>
            <content:encoded><![CDATA[<p>Currently, waste collection systems are in most cases outdated and result in increased carbon footprint, time &amp; cost, environmental pollution, and pick-ups that are unnecessary or on the contrary — long overdue. Unnecessary pickups result in 70% higher annual collection costs. When routes are planned inefficiently, congestion is created, and more fuel is required to complete the collection. Overall, this contributes to a 50% higher carbon footprint</p><p>Getting “smart” means being effective and considerate. Smart waste management helps municipalities and communities reduce their carbon footprint and adopt more environmentally friendly collection routes, contributing to the reduction of gas emissions in the city, reducing their operations costs, and improving daily life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PmRHha4W7AV4iFDFN3MCng.png" /><figcaption>Future of Waste Management</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08ShOWHqsp09Fh2X_HmWcQ.png" /><figcaption>Benefits of Smart Waste Management</figcaption></figure><p><strong>RealCube smart waste management (</strong><a href="https://www.realcube.estate/"><strong>Our Product RealCube</strong></a><strong>) <br></strong>using IoT enables cities and Communities to manage their waste efficiently, be more environmentally responsible by reducing their carbon footprint, and improve the well-being of people. The advantages of smart dustbin solutions combine unique ultrasonic Smart Sensors that monitor waste in real-time with sophisticated software providing cities, communities, and businesses with digital transformation, data-driven decision-making, effective waste management in the community, and optimization of waste collection routes, frequencies, and vehicle loads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qG7MjJb-WfSz2HJTj3EHRg.png" /><figcaption>Workflow</figcaption></figure><p>At the core of smart dustbin technology is a series of wireless ultrasonic sensors that detect fill levels. The IoT devices communicate waste data to sanitation department workers in real-time. Workers can then use the insights from this data to make decisions on waste management adjustments. The adoption of these intelligent waste management solutions will promote a cleaner and safer environment for smart cities. Ultimately, this technology will utilize garbage trucks where they are needed most and reduce wasted trips, lowering emissions and, thus, creating an eco-friendly solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87c_E0w41Bl77SIF1WHLBA.png" /><figcaption>Technical Diagram</figcaption></figure><p>With the use of our IoT-based smart garbage monitoring system for waste management</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Df8ogjvvm8GCC-6rEv-R9Q.png" /><figcaption>Sensor</figcaption></figure><p>Most collection issues can be solved by creating a more efficient pathway for garbage trucks. IoT sensor technology can be used to indicate when emptying is needed. This customized and dynamic system for waste management can allow communities, businesses, organizations, and citizens to all benefits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*APDUK3OAgPICjVtSvwHoLQ.png" /><figcaption>Bin Empty Criteria ~ POC Features</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rf2t8neI-I1oY0kd5ADsbg.png" /><figcaption>Waste Collector App</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ylGuHClPR3UTg1whSagNzA.png" /><figcaption>Dashboard (Alerts, Analytics, Map View, Bin Location etc)</figcaption></figure><p>We did a POC for this below is the attached video link<br><a href="https://youtu.be/JDF882ctkKc">https://youtu.be/JDF882ctkKc</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9452b818aeec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sign In with Apple — Private Email Relay Service]]></title>
            <link>https://medium.com/@balichowdry/sign-in-with-apple-private-email-relay-service-e43ce83c2693?source=rss-56a75ae386b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e43ce83c2693</guid>
            <category><![CDATA[configure-domain]]></category>
            <category><![CDATA[sign-in-with-apple]]></category>
            <category><![CDATA[register-domain]]></category>
            <dc:creator><![CDATA[Bali Chowdry]]></dc:creator>
            <pubDate>Wed, 13 May 2020 13:54:20 GMT</pubDate>
            <atom:updated>2021-11-24T08:46:07.420Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Sign In with Apple — Configure Domain</strong><br><strong>This article focuses on configure domain only for Sign in with apple</strong></p><p>Sign in with Apple brings power to the user to hide the email address. If we do not configure our domains on apple developer portal we will fail to communicate to our user/consumer.</p><h3>Sign in with Apple JS</h3><p><a href="https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js">https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js</a></p><ol><li><a href="https://appleid.apple.com/signinwithapple/button">Click “Sign In With Apple” button</a></li><li>Your app’s current parent tab will open Apple’s login page in the new child tab with some metadata in the browser’s URL as query params.</li><li>The user authenticates the identity after using Apple credentials and is redirected back to the URL which is the parent tab from where we had navigated.</li><li>Apple will send a “FORM_POST” request with data to the redirect URL specified in the Apple developer&#39;s account configuration.</li><li>User completes and verifies the sign-up flow for their site. And now you can apply your next request on a process for an authorized user.</li></ol><p><strong>Required metadata from Apple developer account :</strong></p><ol><li><strong>Client ID:</strong> We will get this from the Services IDs config as an identifier value. Example: “com.myapp.bundle.backend”</li><li><strong>Redirect URL:</strong> This is the URL which we will add in Web Authentication Configuration setup → Website URLs → Return / Redirect URLs. Example: <a href="https://www.abc.com/api/auth-apple-signin">https://www.xyz.com/api/auth-apple-signin</a></li></ol><ul><li>First, <a href="https://www.google.co.in/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwigkYn26LzwAhXFX3wKHcgUA3EQFjAAegQIAxAE&amp;url=https%3A%2F%2Fdeveloper.apple.com%2F&amp;usg=AOvVaw1qN8yLk7zDjnuzW8OlcbLm">sign in to the Apple Developer Account</a> and click on Certificates, Identifiers, and Profiles.</li><li>From the sidebar, choose Identifiers then click the blue plus icon.</li><li>Choose <strong>App IDs</strong> in this first step.</li><li>Choose platform as “iOS”, enter some descriptive words in the description and choose Bundle ID: “Explicit” and enter the value as shown in the following example. “com.myapp.bundle” → replace myapp text with your app_name.</li><li>Now scroll down and check the box next to “Sign In with Apple”.</li><li>Confirm and move to configure the next step which is <strong>Services IDs.</strong></li><li>Enter the description and enter “com.myapp.bundle.backend” in the identifier field and also check the Sign In with Apple checkbox and click configure.</li><li>Now you are at the Web Authentication Configuration screen where you have to select your app from Primary App ID ( make sure you select the one which starts with your app name ).</li><li>Enter domain/sub-domain in Website URLs from which you will send the request to the Apple server ( you can add multiple URLs; do not add localhost or IP address as it is not allowed, for example: <a href="https://www.abc.com/).">https://www.xyz.com/).</a></li><li>Enter redirect URLs as well where Apple will send the response back after authenticating the user. Example: <a href="https://www.abc.com/api/auth-apple-signin">https://www.xyz.com/api/auth-apple-signin</a></li></ul><p>Your request URL should be like this</p><p><a href="https://appleid.apple.com/auth/authorize?response_type=code&amp;redirect_uri=https://fair-dev.otoz.biz/apple/redirect&amp;client_id=com.otoz.signintest">https://appleid.apple.com/auth/authorize?response_type=code&amp;redirect_uri=&lt;redirectURL&gt;&amp;client_id=</a>&lt;ClientID&gt;</p><p>if you hit this URL after replacing &lt;redirectURL&gt; &amp; ClientID<br>it will open web login and redirect to your website after apple authentication.</p><ul><li><a href="https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms#3332113">Click here to read more on query params</a>.</li><li><a href="https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms">Click here to read more about the sign-in process described in the Apple doc</a>.</li></ul><h4>Sign in with Apple for Email Communication</h4><p>Allow users to set up an account, sign in to your apps and associated websites with the Apple IDs they already have. The configuration is required to communicate with your users and receive updates from Apple.</p><p>We need to configure our domains and subdomains so we can communicate with our users with emails only generated by those registered domains and subdomains.<br>This document will help us understand what steps need to perform to register our domain with the apple developer portal.</p><p>When we click Sign in with Apple in our web/app,</p><p>Sign in with Apple present two options:</p><ol><li>Share my email:<br>This will share the user’s personal email address.</li><li>Hide my email:<br>This will create a unique, random address for users.</li><li>When the user chooses to hide my email, we will not receive the user’s actual email address, which means it can’t be used for marketing, advertising purposes.<br>Apple’s new private email relay service will generate a unique email.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*t9yDyx_H3wBcnu2y8wpmyA.jpeg" /></figure><ul><li><strong>Hide my email</strong></li></ul><ol><li>Private relay email addresses have the following characteristics:</li></ol><ul><li>This address looks like this<br> &lt;unique-alphanumeric-string&gt;@privaterelay.appleid.com</li><li>All emails sent to this address by our app/web will automatically be forwarded to user/consumer’s personal email address by Apple’s private email relay service.</li><li>There is a concept of DEVELOPMENT TEAM within apple developer portal, App is uniquely identified based on app identifier but if all the app’s under one Development team email generated by apple’s email relay service will remain same for all apps.</li></ul><p><strong>Register domain with Apple</strong><br>We need to perform multiple steps to register our domain.</p><p>Open Apple developer portal<br><a href="https://developer.apple.com/account/resources/certificates/list">https://developer.apple.com/account/resources/certificates/list</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aFU3iVazNyZiLGkrglSZ_w.png" /></figure><p>Click on last option `More` &gt; Configure</p><p>Next, you need to click the `configure` button.<br>In the “Domains and Associated Email Addresses” section, enter your domain name and subdomains separated by `,` <br>and then click Register.</p><p>*Important*<br>Registration will fail if the domain does not publish an SPF DNS.</p><p><strong>Where we need to register SPF for our domain</strong></p><p>This process is vary based on where would you like to send your email from (G Suite, Mailchimp, etc.)<br>In my case was G Suite.<br>If we are using Google to sending an email we can follow the steps below<br><a href="https://support.google.com/a/answer/33786?hl=en">https://support.google.com/a/answer/33786?hl=en</a></p><p>We need to set up sender like this</p><pre>`v=spf1 include:_spf.google.com ~all`</pre><p><strong>NOT Needed NOW</strong><br>A few weeks back, we need this file to upload to `apple-developer-domain-association.txt`</p><p>as per apple’s latest documentation not needed now, they exclude it previously it was one of the step mentioned but not mentioned about exclusion — — Apple’s way</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/0*nrkimv_cQhlDmHXk" /></figure><p><a href="https://help.apple.com/developer-account/?lang=en#/dev1c0e25352">https://help.apple.com/developer-account/?lang=en#/dev1c0e25352</a></p><p>Once registered.</p><p><strong>Register Subdomains</strong><br>If we have subdomain and we want to enable them as well for testing purpose or any other use cases. Add domain and subdomain separate by ,</p><p>You can click verify button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yNwLxoUp2Gd8ldkEESxzIw.png" /></figure><p>If you see Green CheckBox, Congratulations!! <br>All done.</p><p>Now you can communicate with user/consumer’s using email generated by Apple Email relay service.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e43ce83c2693" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>