<?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 Savindi Waduge on Medium]]></title>
        <description><![CDATA[Stories by Savindi Waduge on Medium]]></description>
        <link>https://medium.com/@savindiwaduge7?source=rss-78e74792dae2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fNWCuePOS7GG97XL</url>
            <title>Stories by Savindi Waduge on Medium</title>
            <link>https://medium.com/@savindiwaduge7?source=rss-78e74792dae2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 16:27:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@savindiwaduge7/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[Add login to your app in minutes with Asgardeo’s new onboarding wizard]]></title>
            <link>https://medium.com/identity-beyond-borders/add-login-to-your-app-in-minutes-with-asgardeos-new-onboarding-wizard-5c15ec742801?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c15ec742801</guid>
            <category><![CDATA[identity]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[asgardeo]]></category>
            <category><![CDATA[onboarding]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Sun, 17 May 2026 17:12:06 GMT</pubDate>
            <atom:updated>2026-05-17T17:12:06.114Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4F6-w-kSNZZ5RMkacgZeVg.png" /><figcaption>Asgardeo’s Onboarding Wizard</figcaption></figure><p><a href="https://wso2.com/asgardeo/">Asgardeo</a> is an Identity Provider (IdP). It lets you add secure authentication to your apps, manage your users, handle single sign-on, adaptive MFA, and B2B organization management, among much more.</p><p>The first thing most developers want after signing up to an IdP is to add secure login to an application. So Asgardeo now has a guided wizard that takes you straight there, whether or not you’ve worked with an IdP before.</p><h4>Guidance from the moment you sign up</h4><p>Once you sign up, you get a guided wizard to add login to an application. You can <strong>dive straight into a step-by-step setup</strong> for your own app, or, if you’d rather see it working first, <strong>launch a live playground to preview the login</strong> experience before integrating anything.</p><p>In a few steps, you can:</p><ul><li>Register your application</li><li>Add login methods</li><li>Brand the login screen with your organization’s logo and colors</li><li>Enable user sign-up</li><li>Grab a custom <strong>prompt for your AI coding assistant </strong>to scaffold the integration in your codebase</li></ul><p>Here’s a quick walkthrough.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UuIzsIjpq6eUVliMjxpDjw.gif" /></figure><h4>Built for first-time users and fast for everyone else</h4><p>You don’t need to be an Identity and Access Management (IAM) expert to add login to your app with Asgardeo. The onboarding wizard handles the decisions that don’t need your input and surfaces the ones that do.</p><p>For developers who already know their way around, it doubles as a quick tour of what Asgardeo supports. It won’t cover everything, because Asgardeo is feature-rich, so the <a href="https://wso2.com/asgardeo/docs/">docs</a>, <a href="https://discord.com/invite/wso2">Discord</a>, and <a href="https://stackoverflow.com/questions/tagged/wso2-asgardeo">StackOverflow</a> are there when you need to go deeper or need help.</p><h4>Skipped it, or want to add login to another app later?</h4><p>You can relaunch the wizard anytime from the Console Home page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wRrEP9egGIMypV_2dQKWNw.png" /></figure><p><a href="https://console.asgardeo.io/">Try it out!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c15ec742801" width="1" height="1" alt=""><hr><p><a href="https://medium.com/identity-beyond-borders/add-login-to-your-app-in-minutes-with-asgardeos-new-onboarding-wizard-5c15ec742801">Add login to your app in minutes with Asgardeo’s new onboarding wizard</a> was originally published in <a href="https://medium.com/identity-beyond-borders">Identity Beyond Borders</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Behind the Scenes: RTL Support in WSO2 Identity Server]]></title>
            <link>https://medium.com/@savindiwaduge7/behind-the-scenes-rtl-support-in-wso2-identity-server-bb6166fc903e?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb6166fc903e</guid>
            <category><![CDATA[right-to-left]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[localization]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Mon, 23 Jun 2025 18:55:19 GMT</pubDate>
            <atom:updated>2025-06-23T18:55:19.902Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwixjKfzQUkQwc6cDxcbvg.png" /></figure><p><a href="https://wso2.com/identity-server/">WSO2’s identity server</a> now supports right-to-left (RTL) ⬅️ for languages out of the box!</p><p>RTL languages like Arabic, Hebrew, and Persian are written and read from right to left. Supporting it in user interfaces is <strong>important for accessibility and localization</strong>. With the release of Identity Server 7.1.0, users can experience a fully mirrored interface when using RTL languages in the <strong>authentication and recovery portals</strong>.</p><p>In this blog we will look at how we implemented this feature.</p><p>Identity Server uses the UI library, <a href="https://react.semantic-ui.com/">Semantic UI React</a> in its authentication and recovery portals.</p><h3>So why didnt we use the UI library’s built in RTL tool?</h3><p>Semantic UI does come with a built-in RTL converter script that works through a Gulp-based build pipeline.. However, this approach wasn’t ideal for our setup.</p><p>At WSO2 Identity Server, we’ve moved away from Gulp in favor of a more modern, modular toolchain based on pnpm, custom Node scripts, and isolated module builds (like the theme module in Identity Apps). Integrating the Semantic UI RTL converter would have required adopting or partially emulating the older Gulp pipeline, which would introduce unnecessary complexity, duplication, and maintenance overhead.</p><p>Instead, we opted for a cleaner, programmatic approach using RTLCSS. It integrates seamlessly into our existing build scripts and works directly within our Node.js environment without needing to run Gulp tasks.</p><p>This gave us:</p><ul><li>Full control over the RTL output</li><li>Cleaner integration into the theme build script.</li><li>A single unified pipeline using pnpm and postcss without legacy tooling</li></ul><p>In short: using Semantic UI’s RTL pipeline would have meant working against our current build system, while RTLCSS allowed us to work with it.</p><h3>In comes RTLCSS ✨</h3><p>(..not sponsored)</p><p>We integrated <a href="https://rtlcss.com/index.html"><strong>RTLCSS</strong></a> into our build pipeline to generate RTLcompatible styles based on our existing Semantic UI theme.</p><p>RTLCSS is a PostCSS plugin that transforms LTR CSS rules into their RTL equivalents (like margin-left → margin-right). It’s fast, reliable, and fully customizable which allowed us to:</p><ol><li>Retain our custom theming and component overrides</li><li>Generate RTL stylesheets alongside LTR without duplicating logic</li><li>Apply direction-specific fixes when necessary</li></ol><p>We used this to extend the <a href="https://github.com/wso2/identity-apps/tree/master/modules/theme">theme</a> module in the <a href="https://github.com/wso2/identity-apps/tree/master">Identity Apps repository</a>, which houses all shared theming logic and styles for the WSO2 Identity Server web apps.</p><p>The following steps were taken to implement this feature:</p><ol><li><strong>Integrate RTLCSS into the Theme Build Script</strong></li></ol><p>In <a href="https://github.com/wso2/identity-apps/blob/master/modules/theme/scripts/build.js">modules/theme/scripts/build.js</a>, we added:</p><pre>const rtlcss = require(&quot;rtlcss&quot;);<br><br>/**<br> * Generates RTL CSS files using rtlcss.<br> *<br> * @param {string} ltrCss - LTR CSS content.<br> * @returns {string} RTL-compatible CSS content.<br> */<br>const generateRTLCSS = (ltrCss) =&gt; {<br> return rtlcss.process(ltrCss);<br>};</pre><p>The script takes the compiled LTR CSS (<em>output.css</em>), processes it through <em>rtlcss</em>, and writes out both <em>theme.min.css</em> and <em>theme.rtl.min.css</em>. These files are then bundled as part of each theme.</p><p>2. <strong>Detect the current language’s direction (LTR or RTL), load the correct stylesheet</strong> (<em>.rtl.min.css</em> or regular <em>.min.css</em> ), and <strong>set the <em>dir</em> attribute</strong> in the DOM to mirror the UI correctly.</p><p><em>Note: There is a language selection in Identity Server authentication portal. once this language is changed the value gets added to a cookie. based on the selected languge the css files to be rendered is decided.</em></p><p>At runtime (in <a href="https://github.com/wso2/identity-apps/blob/master/identity-apps-core/apps/authentication-portal/src/main/webapp/includes/header.jsp"><em>header.jsp</em></a>):</p><p>i. Language is read from the ui_lang cookie</p><pre>Cookie[] userCookies = request.getCookies();<br>for (Cookie cookie : userCookies) {<br>    if (&quot;ui_lang&quot;.equals(cookie.getName())) {<br>        language = cookie.getValue();<br>    }<br>}</pre><p>ii. Direction is extracted from the <a href="https://github.com/wso2/identity-apps/blob/master/identity-apps-core/apps/authentication-portal/src/main/resources/LanguageOptions.properties"><em>LanguageOptions.properties</em></a> file (e.g. lang.switch.ar_AE=ar,Arabic — العربية,rtl)</p><pre>String direction = languageDirectionMap.getOrDefault(language, &quot;ltr&quot;);</pre><p><em>Note : </em>📚<em> </em><a href="https://is.docs.wso2.com/en/latest/guides/branding/localization/"><em>FInd out more on localization</em></a><em> in WSO2 Identity server</em></p><p>iii. Based on the specified language direction, load the css file.</p><p>Stylesheet is conditionally selected based on the direction:</p><ul><li><em>theme.rtl.min.css</em> for RTL</li><li><em>theme.min.css </em>for LTR</li></ul><p>So we add some condition like follows:</p><pre>if (direction.equals(&quot;rtl&quot;) &amp;&amp; file.endsWith(&quot;.rtl.min.css&quot;)) {<br>     themeFileName = file;<br>} else if (direction.equals(&quot;ltr&quot;) &amp;&amp; !file.contains(&quot;.rtl&quot;) &amp;&amp; file.endsWith(&quot;.min.css&quot;)) {<br>     themeFileName = file;<br>}</pre><p><em>Note: Add a fallback logic to ensure a valid .min.css is always selected.</em></p><p>iv. Set <em>dir</em> Attribute Dynamically</p><pre>&lt;script type=&quot;text/javascript&quot;&gt;<br>  const direction = &quot;&lt;%= direction %&gt;&quot;;<br>  if (direction) {<br>      document.documentElement.setAttribute(&quot;dir&quot;, direction);<br>  }<br>&lt;/script&gt;</pre><p>This ensures the entire HTML document is marked as RTL or LTR at runtime so that CSS and layout behave accordingly.</p><p>📝 Key notes on this approach:</p><ul><li><strong>Dynamic CSS loading</strong>: RTL vs LTR stylesheet chosen at runtime.</li><li><strong>Direction-aware HTML rendering</strong>: <em>&lt;html dir=”rtl”&gt;</em> is set via JavaScript.</li><li><strong>Theme-safe</strong>: Logic is scoped to theme directory.</li><li><strong>Cookie-driven language</strong>: Language is fetched from <em>ui_lang</em> cookie.</li></ul><p>You can view detailed implementation details in this <a href="https://github.com/wso2/identity-apps/pull/7292">pull request</a>.</p><h3>How Can You Add an RTL Language to Identity Server?</h3><p>You can add RTL languages to the authentication and recovery portals from version 7.1.0.</p><ol><li>Navigate to the following directory based on the endpoint you want to configure:</li></ol><ul><li>Authentication endpoint: &lt;IS_HOME&gt;/repository/deployment/server/webapps/authenticationendpoint/WEB-INF/classes/</li><li>Recovery endpoint: &lt;IS_HOME&gt;/repository/deployment/server/webapps/accountrecoveryendpoint/WEB-INF/classes/</li></ul><p>2. Open the <em>LanguageOptions.properties</em> file.</p><p>3. Add the ,rtl suffix to the language entry in the file. For example, to enable RTL for Arabic, update the entry as follows:</p><pre>lang.switch.ar_AE=ar,Arabic - العربية,rtl</pre><p>📚<a href="https://is.docs.wso2.com/en/next/guides/branding/localization/#right-to-left-rtl-language-support"> See the full documentation here</a>.</p><p>Give it a try and experience the enhanced accessibility (and security) offered by WSO2 Identity Server! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb6166fc903e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Human-Centered UX Matters?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/design-bootcamp/why-human-centered-ux-matters-0a957c159b85?source=rss-78e74792dae2------2"><img src="https://cdn-images-1.medium.com/max/1200/1*PZbtYoN0QQqb99YenkDHCQ.png" width="1200"></a></p><p class="medium-feed-snippet">Human-centered design is work coming from empathy and understanding. It ensures that design matches the needs, psychology and capabilities&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/design-bootcamp/why-human-centered-ux-matters-0a957c159b85?source=rss-78e74792dae2------2">Continue reading on Bootcamp »</a></p></div>]]></description>
            <link>https://medium.com/design-bootcamp/why-human-centered-ux-matters-0a957c159b85?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a957c159b85</guid>
            <category><![CDATA[human-centered-design]]></category>
            <category><![CDATA[design-challenge]]></category>
            <category><![CDATA[empathy]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[bias]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Wed, 20 Nov 2024 09:45:11 GMT</pubDate>
            <atom:updated>2024-11-21T12:26:26.003Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Simplify React App Login with Asgardeo]]></title>
            <link>https://medium.com/identity-beyond-borders/simplify-react-app-login-with-asgardeo-0a0a94852464?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a0a94852464</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[login]]></category>
            <category><![CDATA[identity-provider]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Tue, 02 Jul 2024 17:11:05 GMT</pubDate>
            <atom:updated>2024-07-03T04:27:58.766Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eApHvWUcg7-j52Er" /></figure><h4>Introduction</h4><p>React is a popular JavaScript library for building dynamic single-page applications. It allows developers to create responsive interfaces by breaking down complex UIs into reusable components.</p><p>Adding a login system to your React app is essential for managing user access and personalizing experiences. It secures user data and enhances engagement.</p><p>Security is crucial for protecting user information and complying with regulations like GDPR and CCPA. Using tools like Asgardeo for identity and access management can help implement a secure login system efficiently.</p><p>In this guide, we’ll show you how to Implement user login in your React app and integrate with a OpenID Connect based Identity Provider (IdP) making the login process simple and secure.</p><p>Here are the steps we will follow,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v6W6VKFiqNzTlIzU" /></figure><p>Grab a cuppa, let’s get started! ☕️</p><h4>Step 1 : Create your React App</h4><p>If you want to try out this sample application without going through this guide, you can use the sample React app<a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/tree/main/samples/asgardeo-react-app"> <em>here</em></a> with the necessary boilerplate.</p><p>For this guide, I’m going to create a simple React app using<a href="https://vitejs.dev/"> <em>Vite</em></a>. Run the following command to create your first React sample application. You need to install npm to run this sample unless npm is already installed in your environment.</p><pre>npm create vite@latest</pre><p>Step 2 : Integrate a login SDK</p><p>Implementing a login page using OpenID Connect involves several tasks, such as rendering login/logout links, making an OpenID Connect request from the application to the Identity provider with the necessary security controls, validating the IDToken returns by the IdP, retrieving the user attributes from the IDToken, retrieving refresh tokens and access tokens, handling the logout request etc. It’s perfectly ok to implement these capabilities by yourself but you don’t need to do so, because there are production-grade login SDKs available to simplify the above tasks.</p><p>Integrating your application with an identity provider simplifies user authentication and ensures secure access to resources, offloading complex tasks like credential management and session handling.</p><p>In this guide, we demonstrate using <a href="https://wso2.com/asgardeo/">Asgardeo</a> for seamless and secure authentication, applicable to any modern identity provider.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PBekd5t655zlLCRn" /></figure><p>The Asgardeo<a href="https://www.npmjs.com/package/@asgardeo/auth-react"> <em>Auth React SDK</em></a> lets React apps use Asgardeo for authentication. It offers features such as <em>user authentication</em>, showing <em>user info</em>, and <em>HTTP hook to send requests attaching Asgardeo tokens.</em></p><p><em>Check out its</em><a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/blob/main/API.md#apis"><em> list of APIs.</em></a></p><p>Run the following command to install the React SDK and the necessary dependencies from the npm registry.</p><pre>npm install @asgardeo/auth-react react-router-dom</pre><p><em>Note — react-router-dom is a package that enables navigation and routing functionalities within React applications. and we need this when discussing Securing Routes in the App.</em></p><ul><li>Configure the <strong>&lt;AuthProvider /&gt;</strong></li></ul><p>The AuthProvider component allows you to integrate an identity provider like Asgardeo into your app. To do that, wrap the application with the AuthProvider component.</p><p>AuthProvider takes a config object as a prop which is used to initialize the SDK instance.</p><h4><strong>Step 3 : Integrate with an Identity Provider</strong></h4><p>If your user login requirements are simple, probably you can implement a login module backed by a simple database table, but when you encounter additional user login requirements such as multi-factor authentication (MFA), social logins, account provisioning and account management requirements you will end up spending more time implementing, testing and maintaining standard Identity and access management (IAM) capabilities that are readily available with IAM solutions rather than worrying on your core business capabilities.</p><p>In this guide we will use Asgardeo as the identity provider for our application.</p><p><strong>What is Asgardeo?</strong></p><p>Asgardeo is a developer-focused cloud identity solution that makes it easy to add secure login and manage user identities in your apps. It simplifies authentication with ready-to-use templates, SDKs, and guides, boosting developer efficiency. Asgardeo ensures top-notch security and compliance, supporting standard protocols and adaptive authentication.</p><p>Now, let’s configure our created application with Asgardeo.</p><p><strong>Sign up for Asgardeo</strong></p><p>If you have not already set up an account in Asgardeo,<strong> </strong><a href="https://wso2.com/asgardeo/docs/get-started/create-asgardeo-account/"><em>Create an account</em></a> and sign up.</p><p>You will be redirected to the<a href="https://console.asgardeo.io/"> </a><em>Asgardeo Console </em>✨<em>.</em></p><p><strong>Create an Application</strong></p><p>Next, let’s register your React app in Asgardeo.</p><ol><li>On the<a href="https://console.asgardeo.io/"> <em>Asgardeo Console</em></a>, go to Applications.</li><li>Click New Application.</li><li>Select Single-Page Application.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iByQE-K7CSnw6ZwQ" /></figure><p>4. Complete the wizard popup with a suitable name and an authorized redirect URL.</p><p><em>Note — authorized redirect specifies where Asgardeo should direct users once they’ve successfully logged in. Usually, it’s the web address where your application is hosted.</em></p><p>Once you create the application, you will be directed to the Quick Start tab of the created application which will guide you to integrate login to your application in several technologies like React, Angular, and Vanilla Javascript.</p><p><em>Hint — Use the information available in the Quick Start tab of your app or the Quickstart guide under the React SDK for the AuthProvider config.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3g_XvIwsa_TFr9Vv" /></figure><pre>import { AuthProvider } from &quot;@asgardeo/auth-react&quot;;<br>const authConfig = {<br>    signInRedirectURL: &quot;http://localhost:3000&quot;,<br>    signOutRedirectURL: &quot;http://localhost:3000&quot;,<br>    clientID: &quot;&lt;client_ID&gt;&quot;,<br>    baseUrl: &quot;https://api.asgardeo.io/t/&lt;org_name&gt;&quot;,<br>    scope: [&quot;openid&quot;, &quot;profile&quot;]<br>};<br>const App = () =&gt; {<br>    return (<br>        &lt;AuthProvider config={authConfig}&gt;<br>            &lt;App /&gt;<br>        &lt;/AuthProvider&gt;<br>    )<br>}<br>export default App;</pre><p><em>signInRedirectURL — The URL to redirect to after the user authorizes the client app. eg: https//localhost:3000/sign-in</em></p><p><em>signOutRedirectURL — The URL to redirect to after the user</em></p><p><em>clientID — The client ID of the OIDC application hosted in the Asgardeo.</em></p><p><em>baseUrl — The origin of the Identity Provider. eg: https://www.asgardeo.io/t/&lt;org_name&gt;</em></p><p><em>scope — Specifies the requested scopes.</em></p><p>Once you’ve added the AuthProvider to the root component, you can use the<a href="https://www.npmjs.com/package/@asgardeo/auth-react#useauthcontext-hook"> <em>useAuthContext()</em></a> hook anywhere in your app to handle user authentication easily.</p><p><a href="https://www.npmjs.com/package/@asgardeo/auth-react#useauthcontext-hook"><em>useAuthContext</em></a> is a React hook that returns the session state that contains information such as the email address of the authenticated user and the methods that are required for implementing authentication.</p><p><em>Note — You can refer to more details about AuthProvider config</em><a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/blob/HEAD/API.md#authprovider"><em> here</em></a><em>.</em></p><h4>Step 4 : Add Secure Login to Your React App</h4><p>Let’s implement Asgardeo authentication in the React app.</p><p><strong>Create a user</strong></p><p>First, let’s <em>create a user</em> who will access our app (<a href="https://wso2.com/asgardeo/docs/guides/users/">read more</a>)</p><ol><li>Go to<a href="https://console.asgardeo.io/"> <em>Asgardeo Console</em></a><em> &gt; User Management &gt; Users.</em></li><li>Click <em>Add Users</em> &gt; <em>Single User</em>.</li><li>Add the user information and Finish.</li></ol><p><strong>Set up login/logout functionality</strong></p><p>Next, let’s set up a simple login/logout functionality.</p><p>The <em>useAuthContext()</em> hook helps implement authentication functions and access session data, like whether the user is logged in and their unique ID.</p><pre>import { AuthProvider } from &quot;@asgardeo/auth-react&quot;;<br>import { useAuthContext } from &quot;@asgardeo/auth-react&quot;;<br>const authConfig = {<br>    signInRedirectURL: &quot;http://localhost:3000&quot;,<br>    signOutRedirectURL: &quot;http://localhost:3000&quot;,<br>    clientID: &quot;&lt;client_ID&gt;&quot;,<br>    baseUrl: &quot;https://api.asgardeo.io/t/&lt;org_name&gt;&quot;,<br>    scope: [&quot;openid&quot;, &quot;profile&quot;]<br>};<br>const AppContent = () =&gt; {<br>    const { state, signIn, signOut } = useAuthContext();<br>    if (state.isAuthenticated) {<br>        return &lt;button onClick={signOut}&gt;Logout&lt;/button&gt;;<br>    } else {<br>        return &lt;button onClick={signIn}&gt;Login&lt;/button&gt;;<br>    }<br>};<br>const App = () =&gt; (<br>    &lt;AuthProvider config={authConfig}&gt;<br>        &lt;AppContent /&gt;<br>    &lt;/AuthProvider&gt;<br>);<br>export default App;</pre><p>The <em>state</em> object contains information of the authenticated user. Its structure is as follows.</p><pre>{<br>  &quot;allowedScopes&quot;: &quot;openid profile&quot;,<br>  &quot;displayName&quot;: xxxxxx,<br>  &quot;email&quot;: xxxxxx,<br>  &quot;userid&quot;: xxxxxxx,<br>  &quot;isAuthenticated&quot;: true,<br>  &quot;isLoading&quot;: false,<br>  &quot;isSigningOut&quot;: false<br>  &quot;sub&quot;: &quot;xxxxxx&quot;,<br>  &quot;username&quot;: &quot;xxxxxxxx&quot;,<br>}</pre><p>In addition to the <em>state</em> object, <em>signIn</em> and <em>signout</em> methods, the hook also returns<a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/blob/HEAD/API.md#list-of-supported-apis"> other methods.</a></p><p><em>Refer to the final code </em><a href="https://github.com/savindi7/secure-react-app/tree/simple-example"><em>here</em></a><em>.</em></p><p>Now, let’s start the app (<em>npm run dev </em>from root) and see what it looks like.</p><p>This is what my <a href="https://github.com/savindi7/secure-react-app/tree/simple-example">sample app</a> looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WBKyaajcOSDReA88IBef6Q.png" /></figure><p>As we have added a Sign In button, clicking it will redirect you to the Asgardeo login page. There’s no need to create sign-in forms in your app! 💃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HWokj5U2wKdvP-8u" /></figure><p>Now, enter the credentials of the newly created user, click Sign In, and you’ll be directed to the Authorized Redirect URL. It’s that easy!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jt-pjxFvSMoQBHOL" /></figure><p>In summary, Asgardeo simplifies adding authentication to a React app by providing an easy-to-integrate IDaaS platform. By configuring the Asgardeo Auth React SDK and using the useAuthContext hook, developers can quickly implement secure login/logout functionality without creating custom sign-in forms.</p><h4>Securing Routes within the App</h4><p>By securing routes, you ensure that only authenticated users with the appropriate permissions can access sensitive areas of the application.</p><p>The SDK provides multiple approaches to secure routes in your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WIYwuF93N-UTY1_02nd5Vw.png" /></figure><ol><li>Securing a route using the SDK</li></ol><p>With this approach only authenticated users will be taken to the route.</p><p>Eg:</p><pre>const AppContent = () =&gt; {<br><br>    const ProtectedRoute = ({ children }: { children: ReactNode }) =&gt; {<br><br>        const { state } = useAuthContext();<br><br>        if (!state.isAuthenticated) {<br>            return &lt;Unauthenticated /&gt;;<br>        }<br>        return children;<br>    };<br><br>    return (<br>        &lt;Routes&gt;<br>            &lt;Route<br>                path=&quot;/contact&quot;<br>                element={<br>                    &lt;ProtectedRoute&gt;<br>                        &lt;Contact /&gt;<br>                    &lt;/ProtectedRoute&gt;<br>                } /&gt;<br>            &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;<br>            &lt;Route path=&quot;*&quot; element={&lt;PageNotFound /&gt;} /&gt;<br>        &lt;/Routes&gt;<br>    )<br>};<br>//rest of the code.</pre><p>We can have a fallback page to include the page to direct to if the user isn’t authenticated.</p><p><a href="https://github.com/savindi7/secure-react-app/tree/secure-route-sample">Sample code</a></p><p>2. SecureApp</p><p>This component wraps a React component and renders it only if the user is signed in securing the whole React app. Otherwise, it renders the fallback component.</p><p>If the user is not signed in, this component automatically initiates the sign-in flow.</p><p>Eg:</p><pre>&lt;SecureApp<br>  fallback={ &lt;Loader /&gt; }<br>  onSignIn={ onSignInFunction }<br>  overrideSignIn={ overrideSignInFunction }<br>&gt;<br>  &lt;App /&gt;<br>&lt;/SecureApp&gt;</pre><p><a href="https://github.com/savindi7/secure-react-app">Sample Code</a></p><p>3. AuthenticatedComponent</p><p>If the user is authenticated, the component displays the wrapped content. If not, it shows the fallback component passed in, which can be any React element.</p><p>If you don’t include a fallback, it will render a null.</p><pre>&lt;AuthenticatedComponent fallback={ &lt;FallbackComponent /&gt; }&gt;<br>  &lt;SecureComponent /&gt;<br>&lt;/AuthenticatedComponent&gt;</pre><p><a href="https://github.com/savindi7/secure-react-app/tree/authenticated-component-sample">Sample code</a></p><p>In summary, Asgardeo’s SDK offers ways and components like <em>SecureApp</em> and <em>AuthenticatedComponent</em> to ensure only authenticated users can access specific routes or areas within a React app.</p><p>To fully leverage the capabilities of modern web applications, it’s essential to securely access APIs that provide critical data and services. This ensures that sensitive information is protected and only available to authenticated users. Here’s how you can use Asgardeo’s SDK to make secure API requests:</p><h4>Accessing a Protected API</h4><p>Once the user is authenticated and you have obtained an access token from Asgardeo, you can use this token to access protected API endpoints. You can use the <a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/blob/HEAD/API.md#arguments-1"><em>httpRequest</em></a> API provided by the Asgardeo SDK to make HTTP requests to these endpoints.</p><p>This method is used to send http requests to Asgardeo or desired backend. The developer doesn’t need to manually attach the access token since this method does it automatically*.</p><p><em>Note — The storage type must be set to webWorker for the token to be automatically attached. If it’s set to sessionStorage or localStorage, you can implement your own method for attaching the access token to the header.</em></p><p>Here’s a simple example of how you might use the Asgardeo SDK’s <em>httpRequest</em> to call a protected API endpoint, such as <em>/scim2/me</em> (to get the user profile details after signing in):</p><pre>import { useAuthContext } from &quot;@asgardeo/auth-react&quot;;<br><br>const App = () =&gt; {<br><br>    const { httpRequest } = useAuthContext();<br>    const requestConfig = {<br>        headers: {<br>            &quot;Accept&quot;: &quot;application/json&quot;,<br>            &quot;Content-Type&quot;: &quot;application/scim+json&quot;<br>        },<br>        method: &quot;GET&quot;,<br>        url: &quot;https://api.asgardeo.io/t/&lt;org_name&gt;/scim2/me&quot;<br>    };<br><br>    useEffect(() =&gt; {<br>        // Make a GET request to a protected endpoint<br>        httpRequest(requestConfig)<br>            .then((response) =&gt; {<br>                // Handle successful response<br>                console.log(&#39;Response:&#39;, response.data);<br>            })<br>            .catch((error) =&gt; {<br>                // Handle error<br>                console.error(&#39;Error:&#39;, error);<br>            });<br>    }, [])<br>}</pre><p>After creating a basic Asgardeo secure app, there’s more to explore! By utilizing<a href="https://wso2.com/asgardeo/"> <em>Asgardeo</em></a>, we can add various features such as:</p><ul><li><a href="https://wso2.com/asgardeo/docs/get-started/asgardeo-use-cases/#single-sign-on-sso"><em>SSO</em> for enterprise applications</a></li><li><a href="https://wso2.com/asgardeo/docs/guides/authentication/social-login/">Social login and registration (Google, Facebook etc.)</a></li><li><a href="https://wso2.com/asgardeo/docs/guides/authentication/passwordless-login/">Passwordless login</a></li><li><a href="https://wso2.com/asgardeo/docs/guides/branding/">Branding</a> (including<a href="https://wso2.com/asgardeo/docs/guides/branding/ai-branding/"> AI-powered branding</a>!)</li><li><a href="https://wso2.com/asgardeo/docs/guides/user-accounts/account-security/bot-detection/">Bot detection and prevention</a></li></ul><p>Keep exploring and powering up your app with Asgardeo’s vast capabilities. Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a0a94852464" width="1" height="1" alt=""><hr><p><a href="https://medium.com/identity-beyond-borders/simplify-react-app-login-with-asgardeo-0a0a94852464">Simplify React App Login with Asgardeo</a> was originally published in <a href="https://medium.com/identity-beyond-borders">Identity Beyond Borders</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React App Authentication with Asgardeo]]></title>
            <link>https://medium.com/identity-beyond-borders/securing-a-react-app-with-asgardeo-cac462fc95ba?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/cac462fc95ba</guid>
            <category><![CDATA[asgardeo]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[idaas]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Sun, 26 May 2024 15:28:26 GMT</pubDate>
            <atom:updated>2024-07-02T12:37:43.616Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1MlXlYksaH9juIWer3MKA.png" /></figure><p><a href="https://wso2.com/asgardeo/"><strong>Asgardeo</strong></a> is a <em>developer-focused</em>, identity-as-a-service (IDaaS) platform that simplifies application <em>login</em> experiences and <em>identity and access management</em>. In layman’s terms, Asgardeo allows you to add authentication to your application in just a few minutes. And most importantly, <em>security and compliance</em> is at Asgardeo’s Core.</p><p>Here are the steps we will follow in this guide to securing a React app with Asgardeo,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MnYkVOeJGrSPxORvdwQBjQ.png" /></figure><p>Grab a cuppa, let’s get started! ☕️</p><h4>Sign up for Asgardeo</h4><p><a href="https://asgardeo.io/signup"><em>Create an account</em></a> in Asgardeo.</p><p>After you sign up, you will be redirected to the <a href="https://console.asgardeo.io/"><em>Asgardeo Console</em></a><em> </em>✨<em>.</em></p><h4>Create an Application</h4><p>Next, let’s register your React app in Asgardeo.</p><ol><li>On the <a href="https://console.asgardeo.io/"><em>Asgardeo Console</em></a>, go to Applications.</li><li>Click New Application</li><li>Select Single-Page Application.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S-JIPFKqtwWOeqaWf3lOpQ.png" /></figure><p>4. Complete the form with a suitable name and an authorized redirect URL.</p><p><em>Note — authorized redirect specifies where Asgardeo should direct users once they’ve successfully logged in. Usually, it’s the web address where your application is hosted (example: </em><a href="http://localhost:3000/"><em>http://localhost:3000</em></a><em>).</em></p><p>Once you create the application, you will be directed to the Quick Start tab of the created application which will guide you to integrate login to your application in several technologies like React, Angular and Vanilla Javascript.</p><p>In this blog, we will be using a React app.</p><h4>Integrate the <strong>Asgardeo Auth React SDK</strong></h4><p>There are 2 ways you can start <a href="https://wso2.com/asgardeo/docs/get-started/try-your-own-app/react">integrating Asgardeo into a React app</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YjwjUIbUgRI04K3g3e8qgg.png" /></figure><p>You can use the sample React app <a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/tree/main/samples/asgardeo-react-app"><em>here</em></a> with the necessary boilerplate.</p><p>For this guide, I’m going to create a simple React app using <a href="https://vitejs.dev/"><em>Vite</em></a>.</p><pre>npm create vite@latest</pre><p>Optionally, I’ve switched my Vite React app’s port to 3000. You can configure this by following their <a href="https://vitejs.dev/config/">guide</a>.</p><p>Here’s my <em>vite.config.ts file:</em></p><pre>import { defineConfig } from &#39;vite&#39;<br>import react from &#39;@vitejs/plugin-react&#39;<br><br>export default defineConfig({<br>  base: &quot;/&quot;,<br>  plugins: [react()],<br>  preview: {<br>    port: 3000,<br>    strictPort: true,<br>  },<br>  server: {<br>    port: 3000,<br>    strictPort: true,<br>    host: true,<br>    origin: &quot;http://0.0.0.0:3000&quot;,<br>  },<br>});</pre><p>Let’s get the application ready.</p><ul><li>Integrate the <strong>Asgardeo Auth React SDK</strong> or library.</li></ul><p>The Asgardeo <a href="https://www.npmjs.com/package/@asgardeo/auth-react"><em>Auth React SDK</em></a> lets React apps use Asgardeo for authentication. It offers features such as <em>user authentication</em>, access to <em>user info</em>, and <em>HTTP hook to send requests attaching Asgardeo tokens.</em></p><p>Check out its <a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/blob/main/API.md#apis"><em>list of APIs.</em></a></p><p>Run the following command to install the React SDK and the necessary dependencies from the npm registry.</p><pre>npm install @asgardeo/auth-react react-router-dom</pre><p><em>Note — react-router-dom is a package that enables navigation and routing functionalities within React applications. and we need this when discussing Securing Routes in the App.</em></p><ul><li>Configure the <strong>&lt;AuthProvider /&gt;</strong></li></ul><p>The AuthProvider component allows you to integrate Asgardeo into your app. To do that, wrap the application with the AuthProvider component.</p><p>AuthProvider takes a config object as a prop which is used to initialize the SDK instance.</p><p><em>Hint — Use the information available in the Quick Start tab of your app or the Quickstart guide under the React SDK for the AuthProvider config.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5xFzRyDVfyRNREC_g08ig.png" /></figure><pre>import { AuthProvider } from &quot;@asgardeo/auth-react&quot;;<br><br>const authConfig = {<br>  signInRedirectURL: &quot;http://localhost:3000&quot;,<br>  signOutRedirectURL: &quot;http://localhost:3000&quot;,<br>  clientID: &quot;&lt;client_ID&gt;&quot;,<br>  baseUrl: &quot;https://api.asgardeo.io/t/&lt;org_name&gt;&quot;,<br>  scope: [ &quot;openid&quot;,&quot;profile&quot; ]<br>};<br><br>const App = () =&gt; {<br><br>  return (<br>    &lt;AuthProvider config={authConfig}&gt;<br>      &lt;App /&gt;<br>    &lt;/AuthProvider&gt;<br>  )<br>}<br><br>export default App;</pre><p>Once you’ve added the AuthProvider to the root component, you can use the <a href="https://www.npmjs.com/package/@asgardeo/auth-react#useauthcontext-hook"><em>useAuthContext()</em></a> hook anywhere in your app to handle user authentication easily.</p><p><em>Note — You can refer to more details about AuthProvider config </em><a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/blob/HEAD/API.md#authreactconfig"><em>here</em></a><em>.</em></p><h4>Adding Secure Login to Your React App</h4><p>Let’s implement Asgardeo authentication in the React app.</p><p>First, let’s <em>create a user</em> who will access our app.</p><ol><li>Go to <a href="https://console.asgardeo.io/"><em>Asgardeo Console</em></a><em> &gt; User Management &gt; Users.</em></li><li>Click <em>Add Users</em> &gt; <em>Single User</em>.</li><li>Add the user information and Finish.</li></ol><p>Next, let’s set up a simple login/logout functionality.</p><p>The <em>useAuthContext()</em> hook helps implement authentication functions and access session data, like whether the user is logged in and their unique ID.</p><pre>import { AuthProvider } from &quot;@asgardeo/auth-react&quot;;<br>import { useAuthContext } from &quot;@asgardeo/auth-react&quot;;<br><br>const authConfig = {<br>  signInRedirectURL: &quot;http://localhost:3000&quot;,<br>  signOutRedirectURL: &quot;http://localhost:3000&quot;,<br>  clientID: &quot;&lt;client_ID&gt;&quot;,<br>  baseUrl: &quot;https://api.asgardeo.io/t/savindi&quot;,<br>  scope: [ &quot;openid&quot;,&quot;profile&quot; ]<br>};<br><br>const AppContent = () =&gt; {<br>  const { state, signIn, signOut } = useAuthContext();<br><br>  if (state.isAuthenticated) {<br>    return &lt;button onClick={signOut}&gt;Logout&lt;/button&gt;;<br>  } else {<br>    return &lt;button onClick={signIn}&gt;Login&lt;/button&gt;;<br>  }<br>};<br><br>const App = () =&gt; (<br>  &lt;AuthProvider config={authConfig}&gt;<br>      &lt;AppContent /&gt;<br>  &lt;/AuthProvider&gt;<br>);<br><br>export default App;</pre><p>The <em>state</em> object contains information of the authenticated user. Its structure is as follows.</p><pre>{<br>    &quot;allowedScopes&quot;: &quot;openid profile&quot;,<br>    &quot;displayName&quot;: xxxxxx,<br>    &quot;email&quot;: xxxxxx,<br>    &quot;userid&quot;: xxxxxxx,<br>    &quot;isAuthenticated&quot;: true,<br>    &quot;isLoading&quot;: false,<br>    &quot;isSigningOut&quot;: false<br>    &quot;sub&quot;: &quot;xxxxxx&quot;,<br>    &quot;username&quot;: &quot;xxxxxxxx&quot;,<br>}</pre><p>In addition to the <em>state</em> object, <em>signIn</em> and <em>signout</em> methods, the hook also returns <a href="https://github.com/asgardeo/asgardeo-auth-react-sdk/blob/HEAD/API.md#list-of-supported-apis">other methods.</a></p><p>Once you add the Sign In button, clicking it will redirect you to the Asgardeo login page. There’s no need to create sign-in forms within your app! 💃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dy6WealcF0CIo9whBQadXg.png" /></figure><p>Now, enter the credentials of the newly created user, click Sign In, and you’ll be directed to the Authorized Redirect URL (<a href="http://localhost:3000/">http://localhost:3000</a>). It’s that easy!</p><h4>Securing Routes within the App</h4><p>By securing routes, you ensure that only authenticated users with the appropriate permissions can access sensitive areas of the application.</p><p>The SDK provides multiple approaches to secure routes in your application.</p><ol><li>Securing a route using the SDK</li></ol><p>With this approach only authenticated users will be taken to the route.</p><pre>//App.tsx<br>import { AuthProvider, useAuthContext } from &quot;@asgardeo/auth-react&quot;;<br>import { BrowserRouter as Router, Routes, Route } from &quot;react-router-dom&quot;;<br>import Home from &quot;./pages/Home&quot;;<br>import Contact from &quot;./pages/Contact&quot;;<br>import PageNotFound from &quot;./pages/PageNotFound&quot;;<br>import &quot;./App.css&quot;;<br>import Unauthenticated from &quot;./pages/Unauthenticated&quot;;<br>import { ReactNode } from &quot;react&quot;;<br><br>const authConfig = {<br>  signInRedirectURL: &quot;http://localhost:3000&quot;,<br>  signOutRedirectURL: &quot;http://localhost:3000&quot;,<br>  clientID: &quot;&lt;client_ID&gt;&quot;,<br>  baseUrl: &quot;https://api.asgardeo.io/t/&lt;org_name&gt;&quot;,<br>  scope: [&quot;openid&quot;, &quot;profile&quot;]<br>};<br><br>const AppContent = () =&gt; {<br><br>  const ProtectedRoute = ({ children }: { children: ReactNode }) =&gt; {<br>    const { state } = useAuthContext();<br><br>    if (!state.isAuthenticated) {<br>      return &lt;Unauthenticated /&gt;;<br>    }<br><br>    return children;<br>  };<br><br>  return (<br>    &lt;Routes&gt;<br>      &lt;Route<br>        path=&quot;/contact&quot;<br>        element={<br>          &lt;ProtectedRoute&gt;<br>            &lt;Contact /&gt;<br>          &lt;/ProtectedRoute&gt;<br>        } /&gt;<br>      &lt;Route path=&quot;/&quot; element={&lt;Home /&gt;} /&gt;<br>      &lt;Route path=&quot;*&quot; element={&lt;PageNotFound /&gt;} /&gt;<br>    &lt;/Routes&gt;<br>  )<br>};<br><br>const App = () =&gt; (<br>  &lt;AuthProvider config={authConfig}&gt;<br>    &lt;Router&gt;<br>      &lt;AppContent /&gt;<br>    &lt;/Router&gt;<br>  &lt;/AuthProvider&gt;<br>);<br><br>export default App;</pre><p>We can have a fallback page called <em>Unauthenticated.tsx</em> like below to include the page to direct to if the user isn’t authenticated.</p><pre>//Unauthenticated.tsx<br>import { useAuthContext } from &quot;@asgardeo/auth-react&quot;;<br>import { useNavigate } from &quot;react-router-dom&quot;;<br><br>const Unauthenticated = () =&gt; {<br>    const { signIn } = useAuthContext();<br>    const navigate = useNavigate();<br><br>    return (<br>        &lt;div&gt;<br>            &lt;h5&gt;You need to be logged in to access this page&lt;/h5&gt;<br>            &lt;div className=&quot;button-container&quot;&gt;<br>                &lt;button className=&quot;text-button&quot; onClick={() =&gt; navigate(&quot;/&quot;)}&gt;<br>                    Go Back<br>                &lt;/button&gt;<br>                &lt;button onClick={() =&gt; { signIn() }}&gt;Login&lt;/button&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>    );<br>};<br><br>export default Unauthenticated;</pre><p>2. SecureApp</p><p>This component wraps a React component and renders it only if the user is signed in securing the whole React app. Otherwise, it renders the fallback component.</p><p>If the user is not signed in, this component automatically initiates the sign-in flow.</p><pre>&lt;SecureApp<br>    fallback={ &lt;Loader /&gt; }<br>    onSignIn={ onSignInFunction }<br>    overrideSignIn={ overrideSignInFunction }<br>&gt;<br>    &lt;App /&gt;<br>&lt;/SecureApp&gt;</pre><p>3. AuthenticatedComponent</p><p>If the user is authenticated, the component displays the wrapped content. If not, it shows the fallback component passed in, which can be any React element.</p><p>If you don’t include a fallback, it will render a null.</p><pre>&lt;AuthenticatedComponent<br>    fallback={ &lt;FallbackComponent /&gt; }<br>&gt;<br>    &lt;SecureComponent /&gt;<br>&lt;/AuthenticatedComponent&gt;</pre><h4>Accessing a Protected API</h4><p>Once the user is authenticated and you have obtained an access token from Asgardeo, you can use this token to access protected API endpoints. You can use the <em>httpRequest</em> API provided by the Asgardeo SDK to make HTTP requests to these endpoints.</p><p>This method is used to send http requests to Asgardeo or desired backend. The developer doesn’t need to manually attach the access token since this method does it automatically*.</p><p><em>*The storage type must be set to webWorker for the token to be automatically attached. If it’s set to sessionStorage or localStorage, you can implement your own method for attaching the access token to the header.</em></p><p>Here’s a simple example of how you might use the Asgardeo SDK’s <em>httpRequest</em> to call a protected API endpoint, such as /scim2/me (to get the user profile details after signing in):</p><pre>import { useAuthContext } from &quot;@asgardeo/auth-react&quot;;<br><br>const App = () =&gt; {<br>    const { httpRequest } = useAuthContext();<br><br>    const requestConfig = {<br>        headers: {<br>            &quot;Accept&quot;: &quot;application/json&quot;,<br>            &quot;Content-Type&quot;: &quot;application/scim+json&quot;<br>        },<br>        method: &quot;GET&quot;,<br>        url: &quot;https://api.asgardeo.io/t/&lt;org_name&gt;/scim2/me&quot;<br>    };<br><br>    useEffect(() =&gt; {<br>        // Make a GET request to a protected endpoint<br>        httpRequest(requestConfig)<br>            .then((response) =&gt; {<br>                // Handle successful response<br>                console.log(&#39;Response:&#39;, response.data);<br>            })<br>            .catch((error) =&gt; {<br>                // Handle error<br>                console.error(&#39;Error:&#39;, error);<br>            });<br>    }, [])<br>}</pre><p>In this example, we’re attaching the access token in the Authorization header of the HTTP request using the Bearer authentication scheme.</p><p><a href="https://github.com/savindi7/secure-react-app">Code</a></p><p>After creating a basic Asgardeo secured app, there’s more to explore! By utilizing <a href="https://wso2.com/asgardeo/"><em>Asgardeo</em></a>, we can add various features such as:</p><ul><li><a href="https://wso2.com/asgardeo/docs/get-started/asgardeo-use-cases/#single-sign-on-sso"><em>SSO</em> for enterprise applications</a></li><li><a href="https://wso2.com/asgardeo/docs/guides/authentication/social-login/">Social login and registration (Google, Facebook etc.)</a></li><li><a href="https://wso2.com/asgardeo/docs/guides/authentication/passwordless-login/">Passwordless login</a></li><li><a href="https://wso2.com/asgardeo/docs/guides/branding/">Branding</a> (including <a href="https://wso2.com/asgardeo/docs/guides/branding/ai-branding/">AI-powered branding</a>!)</li><li><a href="https://wso2.com/asgardeo/docs/guides/user-accounts/account-security/bot-detection/">Bot detection and prevention</a></li></ul><p>Keep exploring and powering up your app with Asgardeo’s vast capabilities. Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cac462fc95ba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/identity-beyond-borders/securing-a-react-app-with-asgardeo-cac462fc95ba">React App Authentication with Asgardeo</a> was originally published in <a href="https://medium.com/identity-beyond-borders">Identity Beyond Borders</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Contributing to Oxygen UI: A guide]]></title>
            <link>https://medium.com/@savindiwaduge7/contributing-to-oxygen-ui-a-guide-3e95848c28ec?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e95848c28ec</guid>
            <category><![CDATA[material-ui]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[components]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Sun, 20 Aug 2023 17:43:56 GMT</pubDate>
            <atom:updated>2023-08-21T08:15:25.996Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4oDyB1YMBenSCXfil-A1Sg.png" /></figure><p>In my previous <a href="https://medium.com/@savindiwaduge7/oxygen-ui-a-wso2-design-system-88eb7bfce857">article</a>, I spoke about the new UI library by <a href="https://wso2.com/">WSO2</a>, Oxygen UI, and we would love for you to contribute to it and help make it even better than it is today!</p><h4>Introduction</h4><p><a href="https://wso2.github.io/oxygen-ui/">Oxygen UI</a> is built by wrapping <a href="https://mui.com/material-ui/getting-started/overview/">Material UI (MUI)</a> components.</p><p>It includes a number of atomic, compound and custom components for you to use in your application.</p><h4>Setting Up the development environment</h4><p><strong>Mandatory Software &amp; Tools</strong></p><p>To build and write code, ensure you have the following set of tools in your local environment.</p><ul><li><a href="https://git-scm.com/downloads">Git</a></li><li><a href="https://nodejs.org/en/download/">NodeJS</a></li></ul><p><em>Note — This project requires atleast NodeJS v14.6.x or above to work.</em></p><ul><li><a href="https://pnpm.io/installation">pnpm</a></li></ul><p><em>Note — This project adopts </em><a href="https://github.com/pnpm/pnpm/pull/5810"><em>Lockfile v6</em></a><em>. Hence, it’ll not work with </em><em>pnpm v7 or lower. If you do not have the latest pnpm installed, update to the latest pnpm version using the following command.</em></p><pre>pnpm install -g pnpm@latest</pre><p><strong>Setting up Development Tools</strong></p><p>These developer tools will help you have a better developer experience since they’ll help debug code, etc.</p><ul><li>React Developer Tools</li></ul><p><a href="https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en">Download for Chrome</a></p><p><a href="https://addons.mozilla.org/en-US/firefox/addon/react-devtools/">Download for Firefox</a></p><ul><li>ESLint</li></ul><p><a href="https://www.jetbrains.com/help/webstorm/eslint.html">Download for Webstorm</a></p><p><a href="https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint">Download for VS Code</a></p><ul><li>Stylelint</li></ul><p><a href="https://www.jetbrains.com/help/webstorm/using-stylelint-code-quality-tool.html">Setup for Webstorm</a></p><p><a href="https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint">Download for VS Code</a></p><ul><li>ShellCheck</li></ul><p><a href="https://github.com/koalaman/shellcheck#installing">ShellCheck Core</a></p><p><a href="https://github.com/vscode-shellcheck/vscode-shellcheck">Download for VS Code</a></p><ul><li>NX Console</li></ul><p><a href="https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console">Download for VS Code</a></p><p><a href="https://plugins.jetbrains.com/plugin/15000-nx-webstorm">Download for Web Storm</a></p><h4>Setting up the Source Code</h4><p><strong>Fork the repo</strong></p><ol><li><a href="https://docs.github.com/en/github/getting-started-with-github/fork-a-repo">Fork</a> the <a href="https://github.com/wso2/oxygen-ui">repository</a>.</li><li>Clone your fork to the local machine.</li></ol><p>Replace &lt;github username&gt; with your own username.</p><pre>git clone https://github.com/&lt;github username&gt;/oxygen.git</pre><p>3. Set the original repo as the upstream remote.</p><pre>git remote add upstream https://github.com/wso2/oxygen.git</pre><h4>Install the dependencies</h4><p>From the root of the project, execute the following command to install the project dependencies with pnpm.</p><pre>pnpm install</pre><h4>Build the project</h4><p>From the root of the project, execute the following command to build the project.</p><pre>pnpm build</pre><h4>Adding Components to Oxygen UI</h4><p>Use existing components and patterns if they suit your intended functionality.</p><p>Use atomic components to build compound or custom components in your application’s source code if they are specific to your use case/app.</p><p>The definition of done (DOD) of the development of a component is defined as follows.</p><ul><li>Implementation of the component along with the supplementary hooks, utils, etc.</li><li>Unit Tests (With Jest).</li><li>Visual Testing &amp; Accessibility Compliance Testing.</li><li>Story with proper documentation.</li></ul><p>⭐️ Components must be added to the react package.</p><pre>cd packages/react</pre><p>⭐️ Add the component in the <a href="https://github.com/wso2/oxygen-ui/issues/2">component development progress task</a> and tag yourself so everyone knows you are working on the component.</p><p>⭐️ Develop</p><p><strong>Wrapping MUI Components</strong></p><p>MUI components must be wrapped and used. <a href="https://github.com/wso2/oxygen-ui/blob/main/packages/react/src/components/Box/Box.tsx">Example</a>.</p><p><strong>Adding Custom Components</strong></p><p>If there are custom components to be added,</p><ul><li>Outline the requirement and reusability of the component and justify why it must be included in Oxygen UI in the PR.</li><li>Add Figma design files if necessary.</li></ul><p>Once the component is added, update the <a href="https://github.com/wso2/oxygen-ui/issues/2">component development progress task</a>.</p><p>✨ <strong>General guidelines to follow when developing</strong></p><p>1. Always use `forwardRef`</p><p><a href="https://github.com/wso2/oxygen-ui/blob/d497af422b57cfc7fe00834d8a6f0c509bf374e9/packages/react/src/components/CardContent/CardContent.tsx#L21">Example</a></p><p>2. The written component should be polymorphic if the wrapped component has a `component` property.</p><p>MUI allows you to change the root element that will be rendered via a prop called component.</p><p>Check in MUI documentation’s Component API whether the component has a `component` property.</p><p><a href="https://mui.com/material-ui/api/box/#props">&gt; MUI Doc Confirmation</a></p><p><a href="https://github.com/wso2/oxygen-ui/blob/d497af422b57cfc7fe00834d8a6f0c509bf374e9/packages/react/src/components/Box/Box.tsx#L21">&gt; Sample Implementation</a></p><p>3. Ensure the Accessibility checks are passed in the component’s Story.</p><p>4. Ensure that there are no console errors logged by the component.</p><p>5. Follow <a href="https://github.com/wso2/oxygen-ui/blob/main/CONTRIBUTING.md#designing-icons">guidelines</a> when designing icons.</p><p>⭐️ Commit your work</p><p>Follow the <a href="https://github.com/wso2/oxygen-ui/blob/main/CONTRIBUTING.md#commit-message-guidelines">commit guidelines</a> (<strong>IMPORTANT</strong>).</p><p><em>Note — You will have to open up a new PR if the guidelines are not met.</em></p><p>⭐️ Open up a PR</p><p><a href="https://github.com/wso2/oxygen-ui/pull/13">Example PR</a></p><p>and that’s it!</p><p>📚 Other material to understand Oxygen UI</p><ul><li><a href="https://github.com/wso2/oxygen-ui">Github</a></li><li><a href="https://wso2.github.io/oxygen-ui/">Documentation</a></li><li><a href="https://www.npmjs.com/org/oxygen-ui">NPM package</a></li><li><a href="https://medium.com/@savindiwaduge7/oxygen-ui-a-wso2-design-system-88eb7bfce857">Article</a></li></ul><p>Looking forward to your contribution! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e95848c28ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Styling with MUI5 & Sass in a Design System]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@savindiwaduge7/styling-with-mui5-sass-in-a-design-system-bb617b920d13?source=rss-78e74792dae2------2"><img src="https://cdn-images-1.medium.com/max/2600/1*6pAKZOprP7YE1TOgFpxW1g.png" width="2600"></a></p><p class="medium-feed-snippet">While you can use Material UI (MUI)&#x2019;s default styling engine and enjoy its benefits, you might also want to consider using Sass for&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@savindiwaduge7/styling-with-mui5-sass-in-a-design-system-bb617b920d13?source=rss-78e74792dae2------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@savindiwaduge7/styling-with-mui5-sass-in-a-design-system-bb617b920d13?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb617b920d13</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[material-ui]]></category>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Sun, 25 Jun 2023 16:31:46 GMT</pubDate>
            <atom:updated>2023-06-26T03:45:28.783Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Oxygen UI : A WSO2 Design System]]></title>
            <link>https://medium.com/@savindiwaduge7/oxygen-ui-a-wso2-design-system-88eb7bfce857?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/88eb7bfce857</guid>
            <category><![CDATA[mui]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[ui]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Mon, 03 Apr 2023 03:32:47 GMT</pubDate>
            <atom:updated>2023-04-03T03:46:46.335Z</atom:updated>
            <content:encoded><![CDATA[<h3>Oxygen UI : A WSO2 Design System</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MjrGymXocyU2RZ8MLuFkng.png" /></figure><p>WSO2 has got some exciting news for you!</p><p>Your favorite technology company has just introduced a new <strong>design system</strong> that will take your experience with their products to the next level.</p><h4>What is a Design System?</h4><p>As companies are constantly looking for ways to streamline their product design process, one way that has gained popularity in recent years is using design systems.</p><p>A Design System is more than just design.</p><blockquote><strong>“A Design System is a story of how an organization designs and builds digital products.”</strong></blockquote><blockquote>- Brad Frost | The Technical Side of Design Systems | UI Special, CSS Day 2019</blockquote><pre>A <strong>design system</strong> is essentially a set of reusable components, styles, <br>and guidelines that help designers and developers create consistent and <br>cohesive user interfaces across different products and platforms.</pre><h4>Introducing Oxygen UI 🎉</h4><p>WSO2, after being successfully established as an Open Source API management company for more than 15 years, has developed a unique brand and identity. Oxygen UI, as a universal design system, aims to reflect this identity through the User Interfaces of their <a href="https://wso2.com/">digital offerings</a>.</p><p>So, why should you be excited about this design system?</p><p>Well, it will help improve your experience with WSO2’s products even better. By using a consistent design system across all products, you can navigate and use them more easily. No more trying to figure out where a button is or how to use a feature — it’ll all be <strong>intuitive and straightforward as it unifies the look and feel of all the products.</strong></p><h4>What does it offer?</h4><figure><img alt="WSO2 Design System diagram showing the 3 packages introduced in Oxygen UI version 1.0.0 namely, Primitives, React and React Icons." src="https://cdn-images-1.medium.com/max/1024/1*eNWzbsYnu5aPMX1Bj2bWnw.png" /></figure><p>Three modules are introduced in <a href="https://github.com/wso2/oxygen-ui/releases/tag/v1.0.0">version 1.0.0.</a></p><p>First up, <strong><em>primitives</em></strong>. Think of these as the building blocks of your design system. We’re talking colors, typography, spacing, and other basic styles you can use across all your products. By having a consistent set of primitives, design time will be reduced, and products can have that cohesive look and feel.</p><p>Next, we’ve got <strong><em>react</em> </strong>components. These are pre-built UI elements like buttons, forms, and navigation menus that can be easily reused across different products.</p><p>The <strong><em>React Icons</em></strong> module has a library of pre-designed icons that you can drop into your products. Because, who has time to design new icons from scratch?</p><h4><strong>And there’s more! This design system also uses </strong><a href="https://www.uxpin.com/studio/blog/what-are-design-tokens/"><strong>design tokens</strong></a><strong> from </strong><a href="https://www.figma.com/"><strong>Figma</strong></a><strong>.</strong></h4><p>These are variables that define your design properties, like colors and spacing. Using design tokens, you can easily make changes to the design system without having to go in and update every single element by hand. These tokens are a means of <strong>keeping the design and the implementation in sync</strong>.</p><p>Oxygen UI provides a personalized and engaging user experience through the <strong>support of theming</strong>. This means you can customize your design system to match your product branding and style.</p><p>This design system is built on top of the <a href="https://mui.com/">Material UI framework</a>. So you know it’s going to be reliable and scalable. It’s like the swiss army knife of React-based design systems!</p><p>In addition, using Oxygen UI leads to faster product development, where customers get access to new and improved features more quickly with <strong>improved accessibility</strong>.</p><p>As WSO2 commits to demonstrating quality and innovation in their products, a design system like this helps them achieve the primary goal of offering a consistent user experience across products such as <a href="https://wso2.com/asgardeo/">Asgardeo</a> and <a href="https://wso2.com/choreo/">Choreo</a>.</p><p>In conclusion, Oxygen UI is a game-changer for anyone using WSO2’s products. It provides a consistent and cohesive user experience and streamlines the design process, making it faster and more efficient. With its customizable theming options and reliance on design tokens and Material UI, Oxygen UI is a powerful design system that will take your experience with WSO2’s products to the next level.</p><p>So why not give it a <strong>try and see for yourself</strong> how it can enhance your digital offerings?</p><h4>Check out Oxygen UI :</h4><ul><li><a href="https://github.com/wso2/oxygen-ui/releases/tag/v1.0.0">GH Release</a></li><li><a href="https://www.npmjs.com/org/oxygen-ui">npm</a></li><li><a href="https://wso2.github.io/oxygen-ui">docs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88eb7bfce857" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Usage of User Experience (UX) Heuristics in Asgardeo]]></title>
            <link>https://medium.com/@savindiwaduge7/usage-of-user-experience-ux-heuristics-in-asgardeo-e8edb3046cf4?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8edb3046cf4</guid>
            <category><![CDATA[nielsen]]></category>
            <category><![CDATA[wso2]]></category>
            <category><![CDATA[asgardeo]]></category>
            <category><![CDATA[heuristic-evaluation]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Mon, 12 Sep 2022 19:17:02 GMT</pubDate>
            <atom:updated>2022-09-13T07:15:25.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*035cP2krotAQbAefP7FbWw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jexo?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jexo</a> on <a href="https://unsplash.com/s/photos/ux?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>What is UX heuristic evaluation?</h3><p>Well, in simple terms, it’s all about <strong>checking the usability</strong> of a website or an application according to standardized and industry-accepted design conventions.</p><p>There are many ways we can evaluate usability. In this blog, we will assess the usage of the <a href="https://www.nngroup.com/articles/ten-usability-heuristics/">UX heuristics defined by Nielsen</a> in one of the super cool products of WSO2, <a href="https://wso2.com/asgardeo/">Asgardeo</a>.</p><h3>What is Asgardeo?</h3><p>Asgardeo includes all the goodness of the <a href="https://wso2.com/identity-server/">Identity and Access Management solution of WSO2<em> </em></a>packed into one product as an Identity as a service (IDaaS). It <strong>offers secure authentication flows to apps or websites</strong> of an organization. In other words, we can create seamless login experiences for our applications using Asgardeo. We can observe awesome features such as Social Login with Facebook, Github, Google etc., Multi-Factor Authentication, and Conditional authentication. We can also use customized scripts for more robust security and user management.</p><p>How Asgardeo strives to provide a better user experience.</p><ul><li>A <strong>dedicated team</strong> to improve UX.</li><li>Using a <strong>consistent design system</strong> and implementing it across all user flows of Asgardeo.</li><li><strong>Weekly design evaluation</strong> meetings.</li><li><strong>Continuous testing</strong> to evaluate UX vulnerabilities.</li></ul><blockquote>Design is not just what it looks like and feels like. Design is how it works.</blockquote><blockquote>-Steve Jobs</blockquote><p>Now, let’s jump into the main point of this blog.</p><h3>Usage of UX heuristics in Asgardeo</h3><h4>Visibility of system status</h4><p><em>“The design should always inform users about what is going on, through appropriate </em><strong><em>feedback</em></strong><em> within a reasonable amount of time.”</em></p><p>Feedback from the system is vital as it informs the user of the result of their actions. Asgardeo strives to achieve this using loading indicators, progress trackers, notifications etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x5BoTttYA_wWR63-" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*odehkjqvgXrjNYWA" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1Sg-dvhUrkm5-NdJ" /></figure><h4>Match between system and the real world</h4><p><em>“The design should </em><strong><em>speak the users’ language</em></strong><em>. Use words, phrases, and concepts familiar to the user, rather than internal jargon. Follow real-world conventions, making information appear in a natural and logical order.”</em></p><p>Okay, this is purely psychological. When we see something on our screen that is similar to an object or something we use in real life, we tend to know how to use it with minimal guidance. This makes it easier for us to understand, learn and remember how the interface works.</p><p>Asgardeo, based on their user demographic, has identified the appropriate terminology, phrases and concepts that are familiar and have attempted to follow a <a href="https://www.nngroup.com/articles/natural-mappings/">natural mapping</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GTzgeikloCIFrIhf" /></figure><p>We can see that Asgardeo has followed a straightforward design convention at a glance. From the logo, navigation, and CRUD (Create, Read, Update and Delete) options placement to item listings, everything is comprehensively presented to the user, making it easier for them to navigate the application and memorize all the options and features available. These are design patterns used in millions of similar web applications.</p><h4>User control and freedom</h4><p><em>“Users often perform actions by mistake. They need a clearly marked “</em><strong><em>emergency exit</em></strong><em>” to leave the unwanted action without having to go through an extended process.”</em></p><p>Digital spaces should allow users to back out of an action when required. It is essential to foster a sense of confidence and freedom in users to use the system by enabling them to have control over their actions. Basically, support undo, cancel and redo of actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uB1lZU1yk6TaVPke" /></figure><p>Asgardeo has maintained the option to revert changes or cancel any action throughout all their user flows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KO6FPGr7kEZFjuTx" /></figure><p>This super cool feature to customize Asgardeo based on the user’s organizational requirements has its preview section and a toggle to apply and undo changes. These features give a sense of confidence to users to perform any action in the system as they know that it will not face any unwanted state. This sense of trust helps to keep users engaged and retain them in the long term.</p><h4>Consistency and standards</h4><p>“Users should not have to wonder whether different words, situations, or actions mean the same thing. <strong>Follow platform and industry conventions</strong>.”</p><p>According to Jakob’s law of web user experience, users do not only spend time on “our” website. They navigate and browse multiple websites, forming a mental model of what a<strong> </strong>typical site should look like and what design conventions are used in the digital space. It is crucial to not only look inward at the concept of “consistency” but adhere to different design principles and industry practices that are used in general, wherever applicable, so we do not confuse the user and let them experience a negative cognitive load.</p><p>In Asgardeo, we can observe that every user flow maintains a satisfactory level of the same patterns and consistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*MxG8J5bQIwBufdOP5KWwRQ.png" /><figcaption>All Alert message variations defined in Storybook</figcaption></figure><p>The usage of <a href="https://storybook.js.org/">Storybook</a> in Asgardeo’s development effort is one method that they utilize to maintain consistency. Using reusable user interface (UI) components and proper developer documentation ensures that internal consistency is maintained. The development team also maintains a product-specific design system which they update based on industry conventions and standards to ensure external consistency and deliver the best user experience to their customers.</p><h4>Error prevention</h4><p>“Good error messages are important, but the best designs carefully <strong>prevent problems from occurring</strong> in the first place. Either eliminate error-prone conditions, or check for them and present users with a confirmation option before they commit to the action.”</p><p>What is the difference between error prevention and user control and freedom? We must allow users to undo their actions for user control and freedom. But here, we are talking about errors that occur due to mistakes caused by bad design, including confusing UI flows, memory burden and confusing call to actions (CTAs), and inadequate validations in forms, input fields etc. An example of a prevention measure you are probably familiar with is your laptop always informing you to charge it when the power goes below a certain level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6zfj9dHOuNlhORm-" /></figure><p>Asgardeo uses features like the danger zone with the appropriate color to inform users of irreversible actions that are risky or will remove information from the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhBnrbYxcruca5XxM4qLxQ.png" /></figure><p>They also use confirmation dialog boxes to inform users of the consequences of their actions and as an additional step before they do something that will affect the data or information in the system.</p><h4>Recognition rather than recall</h4><p><em>“</em><strong><em>Minimize the user’s memory load</em></strong><em> by making visible elements, actions, and options. The user should not have to remember information from one part of the interface to another. Information required to use the design (e.g. field labels or menu items) should be visible or easily retrievable when needed.”</em></p><p>We cannot assume that all users can learn rapidly and retain superhuman quantities of information. So, the system must have visible and reliable instructions without making them depend on memory. Users must be able to identify features, actions and options available without much effort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-GuzfuEFClZEoCr_" /></figure><p>The summary step displayed at the end of the user creation flow is a great way to display the information typed out by the user and remind them to store certain information which will not be retrievable again.</p><h4>Flexibility and efficiency of use</h4><p><em>“Shortcuts — hidden from novice users — may speed up the interaction for the expert user so that the design can </em><strong><em>cater to inexperienced and experienced users</em></strong><em>. Allow users to tailor frequent actions.”</em></p><p>In simpler terms, we can make the system flexible so that experienced users can achieve goals more efficiently. Users should be able to pick whatever approach that works best for them.</p><p>Asgardeo supports keyboard shortcuts, allowing more experienced users to get things done faster. It accelerates interaction with the system and fastens routine tasks. At the same time, new users are not allowed to be overloaded by the various information available in the system. Since Asgardeo is at its early stages and doesn’t require users to work with a lot of complex data or operations yet, the team is working on the room for improvement in this area while it grows. Asgardeo may work and improve on <a href="https://www.nngroup.com/articles/ui-accelerators/">accelerators</a> such as keyboard shortcuts, macros and app accelerators.</p><h4>Aesthetic and minimalist design</h4><p><em>“Interfaces should </em><strong><em>not contain information that is irrelevant</em></strong><em> or rarely needed. Every extra unit of information in an interface competes with the relevant units of information and diminishes their relative visibility.”</em></p><p>Asgardeo has made a reasonable effort to keep the information to a minimum and not overload the user unnecessarily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XAzx47727NQHHa4c" /></figure><p>In my opinion, Asgardeo gets a big A+ for its minimalist design. It is a very straightforward design with warm colors which are noticeable, lively and welcoming, and it is ideal for the intended look and feel of the product. But I am just talking about the default colors here. The user has the option to customize the theme based on their preferences.</p><h4>Help users recognize, diagnose, and recover from errors</h4><p><em>“Error messages should be expressed in plain language (no error codes), </em><strong><em>precisely indicate the problem</em></strong><em>, and constructively suggest a solution.”</em></p><p>Error messages should be noticeable or easily recognizable. It is crucial to inform users of what went wrong. Here, we must ensure we do not include technical jargon to confuse the user and guide them to make an informed decision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EeBNQ50mLT5xPLZo" /></figure><p>In Asgardeo, error messages based on industry conventions make them very clear and comprehensive. They have also used validation errors with proper styling, like the usage of red text, which visually informs users of mistakes.</p><h4>Help and documentation</h4><p><em>“It’s best if the system doesn’t need any additional explanation. However, it may be necessary to provide documentation to </em><strong><em>help users understand</em></strong><em> how to complete their tasks.”</em></p><p>WSO2’s documentation is always up to date, and accurate as they have a dedicated team of well-experienced technical writers constantly working on maintaining reliability and ensuring user goals are achievable with the appropriate help without having to escalate it to a support ticket.</p><p>In Asgardeo, a link to the product’s documentation is easily accessible and visible at a glance. We can also observe links to specific guides when the user is performing certain tasks that may require additional context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pE3vyoDywCJzOF0B" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YAxSCCcx4dVCAdy9Al2G9g.png" /></figure><p>The Asgardeo team has done a great job of ensuring their users can focus on their tasks and achieve their goals efficiently by providing adequate support and consistency and following industry best practices regarding design conventions. Of course, they have a lot to improve on in their journey of the product’s growth. As an open source company specializing in Application Programming Interface (API) products, their continuous effort to improve their products’ user experience is admirable, and Asgardeo is an excellent example of their persistent efforts.</p><p>Don’t forget to <a href="https://wso2.com/asgardeo/">check Asgardeo out!</a> 🥳</p><h3>References</h3><ul><li><a href="https://www.nngroup.com/articles/ten-usability-heuristics/">10 Usability Heuristics for User Interface Design</a></li><li><a href="https://www.interaction-design.org/literature/topics/heuristic-evaluation">What is Heuristic Evaluation?</a></li><li><a href="https://wso2.com/whitepapers/evaluating-the-user-experience-of-your-enterprise-products-a-framework-for-developers-and-testers/">WSO2 Team</a></li><li><a href="https://careerfoundry.com/en/blog/ux-design/what-is-a-heuristic-evaluation-in-ux/">Heuristic Evaluation In UX Design: The Complete Guide</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8edb3046cf4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conditionally rendering React components using a Java method in identity-apps]]></title>
            <link>https://medium.com/@savindiwaduge7/conditionally-rendering-react-components-using-a-java-method-in-identity-apps-c45f0008f75f?source=rss-78e74792dae2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c45f0008f75f</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[jsp]]></category>
            <category><![CDATA[conditional-rendering]]></category>
            <dc:creator><![CDATA[Savindi Waduge]]></dc:creator>
            <pubDate>Mon, 04 Jul 2022 07:05:07 GMT</pubDate>
            <atom:updated>2022-09-13T06:19:24.917Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uib9RKW-eSBItHAsVAH6LQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/es/@lautaroandreani?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Lautaro Andreani</a> on <a href="https://unsplash.com/s/photos/react-and-java?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>When working with the <a href="https://github.com/wso2/identity-apps">identity-apps repository</a>, containing the front-end code of <a href="https://wso2.com/identity-server/">WSO2’s Identity Server</a>, built using React, there will come requirements where you need to use a returned value of a method or a static variable that is in the back-end without calling an API endpoint.</p><p>This blog explains how we can use Java methods or static variables included in our <a href="https://github.com/wso2/carbon-identity-framework">carbon-identity-framework</a> repository in the identity-apps front-end code.</p><p>In the scenario I will be elaborating on, we assume we are aware of the method or variable already available in the framework repo.</p><p>Let’s start by cloning the repositories and setting them up.</p><h3>Clone the identity-apps repository and set it up</h3><p>First, if you haven’t set up the identity-apps repository, you will need to clone it from <a href="https://github.com/wso2/identity-apps">here</a> and follow the instructions <a href="https://github.com/wso2/identity-apps#run-in-dev-mode">here</a> to set it up in the dev environment. Go through the README file to thoroughly understand the setup process. You need to satisfy the necessary prerequisites to run this module correctly.</p><h3>Clone the carbon-identity-framework repository</h3><p>This repository contains the Java methods or static variables we will try to access in this specific scenario. Clone the carbon-identity-framework repository <a href="https://github.com/wso2/carbon-identity-framework">here</a>. After cloning this repository and opening it up, you can identify the file containing the method or variable you need to import into the identity-apps code.</p><p>Once we know the method we want to use and the file it resides in, we can define the properties with the import statements in the webpack file.</p><p>So let’s open the identity-apps repository in your favorite IDE and do as follows.</p><h4>Define the import(s) in the <em>webpack file</em></h4><p>Webpack file path — <em>{identity-apps}/apps/console/webpack.config.js</em></p><p>Example file the Java method resides in in the Framwork repo — <em>{carbon-identity-framework}/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java</em></p><p>We need to add a property with the string value containing the import statement in the webpack plugin definition where the `filename` property is set to the home.jsp file and is under the conditions that the application is in production and not deployed on a static server.</p><pre>getAdaptiveAuthenticationAvailability: !isDeployedOnExternalServer<br>? &quot;&lt;%@ page import=\&quot;static org.wso2.carbon.identity.application.&quot; +<br>&quot;authentication.framework.util.FrameworkUtils.isAdaptiveAuthenticationAvailable\&quot;%&gt;&quot;<br>: &quot;&quot;,</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KjPm31FUQyYaGKGuTsJxhg.png" /></figure><p>In this example, we have added a property called `getAdaptiveAithenticationAvailability`. It is just a string that contains the import statement for our JSP pages. We do this because identity-apps can be deployed on an external server rather than our embedded Tomcat server, which is bundled inside the Identity Server itself. The second reason is that our templating mechanism also uses a similar syntax (i.e., &lt;%= some code =&gt;). We define all the statements within the webpack config to avoid collisions and safely import modules without breaking the application.</p><p>If it is a method, we must get the import statements as shown above and, in addition, add a property defining the method separately, as shown below, to avoid confusion for the webpack plugin.</p><pre>isAdaptiveAuthenticationAvailable: !isDeployedOnExternalServer<br>? &quot;&lt;%= isAdaptiveAuthenticationAvailable() %&gt;&quot;<br>: &quot;false&quot;,</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S3ZQgEOvwTAehBmB" /></figure><p>Why do we have `isAdaptiveAuthenticationAvailable()` like this? Our goal is to evaluate this function on the server-side, get its value, and do something meaningful with it on the front-end. So, this is how we call a function through JSP. When the page gets rendered, JSP will evaluate this expression and return either true or false in this case.</p><p>To get the correct import path, refer to how we have taken it using the file’s path in the carbon-identity-framework repository as shown below.</p><p>Example file path — <em>{carbon-identity-framework}/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/</em><strong><em>org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils</em></strong><em>.java</em></p><p>Imported page file path — <strong><em>org.wso2.carbon.identity.application.authentication.framework.util.FrameworkUtils</em></strong><em>.isAdaptiveAuthenticationAvailable</em></p><blockquote>Note — The import path usually resolves to a package name in Java. So that is what we should define in the import statement. There can be static imports and module imports. In the above example we use a static import because we only need one method.</blockquote><p>You can refer to how we have imported static variables by studying the rest of the code in the webpack file.</p><h4><em>Assign the returned value of the method to a variable</em></h4><p>Next, to assign this value to a variable to be used in React Components, we need to add it to our home.jsp file.</p><p>Home.jsp file path — <em>{identity-apps}/apps/console/src/home.jsp</em></p><pre>&lt;%= htmlWebpackPlugin.options.getAdaptiveAuthenticationAvailability %&gt;</pre><pre>var isAdaptiveAuthenticationAvailable = JSON.parse(&quot;&lt;%= htmlWebpackPlugin.options.isAdaptiveAuthenticationAvailable %&gt;&quot;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d9J_Tq2KUAMzSKJI" /></figure><p>In the above image, first, we have imported the webpack plugin option we have used containing the relevant string value. Next, in the variable, we have taken the option we used to call the method inside the said file. In this example, we have wrapped the variable with a JSON.parse to convert it into a boolean.</p><p>Next, we need to pass the variable into the AppUtils configuration, defined in the init.ts file, as an argument. For this, first, we need to define the variable type inside the global.d.ts file as follows.</p><p>global.d.ts file path —<em> {identity-apps}/apps/console/types/global.d.ts</em></p><pre>const isAdaptiveAuthenticationAvailable: boolean;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ZWYwnAQnpA45lqycHngeg.png" /></figure><p>Init.ts file path — {identity-apps}/apps/console/src/init/init.ts</p><pre>isAdaptiveAuthenticationAvailable:isAdaptiveAuthenticationAvailable,</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBO2zkfLKFAn8Xqxm5jpxA.png" /></figure><p>Now the variable is ready to be used in the React component!</p><p>Example :</p><pre>{ <br>    isAdaptiveAuthenticationAvailable<br>    &amp;&amp; (<br>        &lt;ScriptBasedFlow <br>            authenticationSequence={ sequence }<br>            isLoading={ isLoading }<br>            onTemplateSelect={ handleLoadingDataFromTemplate }<br>            onScriptChange={ handleAdaptiveScriptChange }<br>            readOnly={ readOnly }<br>            data-testid={ `${ testId }-script-based-flow` }<br>            authenticationSteps={ steps }<br>            isDefaultScript={ isDefaultScript }<br>            onAdaptiveScriptReset={ () =&gt; setIsDefaultScript(true) }<br>         /&gt;<br>     )<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_2rmuLXzm3P-YEZakIFw3g.png" /></figure><p>Here, we check if the variable is true to render the React component called ScriptBasedFlow conditionally.</p><p>And that is all there is on how to use a variable that is defined using a Java method return or a static variable in a React component in the identity-apps repository 🎉.</p><p>You can refer to <a href="https://github.com/wso2/identity-apps/pull/3116">this pull request</a> which includes all the code changes implemented in this scenario.</p><h4>More resources</h4><p><a href="https://webpack.js.org/plugins/html-webpack-plugin/">Read about webpack</a></p><p><a href="https://www.tutorialspoint.com/jsp/index.htm">Read about JSP</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c45f0008f75f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>