<?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 Harsha Karumuri on Medium]]></title>
        <description><![CDATA[Stories by Harsha Karumuri on Medium]]></description>
        <link>https://medium.com/@harsha.karumuri?source=rss-53a016fc2f61------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Harsha Karumuri on Medium</title>
            <link>https://medium.com/@harsha.karumuri?source=rss-53a016fc2f61------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 01:08:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harsha.karumuri/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[Twitter SSO in Mendix using the Twitter API]]></title>
            <link>https://medium.com/mendix/twitter-sso-in-mendix-using-the-twitter-api-7870139517fb?source=rss-53a016fc2f61------2</link>
            <guid isPermaLink="false">https://medium.com/p/7870139517fb</guid>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[twitter]]></category>
            <category><![CDATA[mendix]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[low-code]]></category>
            <dc:creator><![CDATA[Harsha Karumuri]]></dc:creator>
            <pubDate>Thu, 09 Mar 2023 10:07:57 GMT</pubDate>
            <atom:updated>2023-03-09T10:07:57.770Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this blog, I will look at the Twitter SSO (Also known as “login with Twitter”) and how to integrate it into your Mendix app.</h4><figure><img alt="Twitter SSO in Mendix using the Twitter API (Banner Image) A bluebird representing the Twitter Logo, holding a golden ring of keys in its mouth set against the backdrop of a futuristic city" src="https://cdn-images-1.medium.com/max/1024/1*-GZmKb8wuGAoxEmkx2BScQ.png" /><figcaption>Twitter SSO in Mendix using the Twitter API (Banner Image) A bluebird representing the Twitter Logo, holding a golden ring of keys in its mouth set against the backdrop of a futuristic city</figcaption></figure><h4><strong>What is SSO</strong>:</h4><p>Single sign-on (SSO) is a technology that allows users to access multiple apps using a single set of credentials. With SSO, a user only has to enter their login credentials one time, on a single page, to access all of their SaaS applications.</p><h4>Why use Twitter SSO in your Mendix App?</h4><p>You can use Twitter SSO to place a button on your site or app which allows Twitter users to enjoy the benefits of a registered user account in as little as one click.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*o2JtHZL1gJlmJyqTOGRt0w.jpeg" /></figure><h4><strong>Increased productivity</strong></h4><ul><li>SSO ensures that users only have to enter one password to access multiple apps or services. This helps avoid password fatigue, whereby people struggle to remember different passwords for different accounts, and can lead to them recycling credentials across multiple services. This presents a major security risk because attackers exploit commonly used passwords to hack into additional accounts.</li><li>Signing in only once means users spend less time signing into apps. This, in turn, lowers the risk of them using weak passwords or forgetting their login credentials and improves productivity.</li></ul><h4><strong>Stronger security</strong></h4><ul><li>SSO encourages users to deploy stronger passwords on their accounts. It also helps them avoid repeating the same password on multiple accounts. Only requiring one login password for several services makes it easier for users to remember their passwords. This also reduces organizations’ risk of cyber-attacks because websites have to store less user credential information.</li></ul><h3><strong>In the Twitter Developer Portal:</strong></h3><h4><strong>Step 1: Creation of a developer account</strong></h4><ul><li>Login with Twitter in your browser. If you don’t have one already, create a Twitter account.</li><li>First, go to the Twitter developer portal:</li></ul><p><a href="https://developer.twitter.com/en/docs/platform-overview">Twitter Developer Platform overview</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*VRltpZhpG3Xq3e8GW0L6Kw.png" /></figure><ul><li>Sign up for the developer account.</li><li>Go to the Projects &amp; Apps folder and create a project.</li><li>In that project, click add an app.</li><li>Choose an App environment (Development).</li><li>Then name your App.</li><li>You will get <strong>API Key</strong>, <strong>API Key Secret</strong>, and <strong>Bearer Token</strong>.</li><li>Write them down. We will use them later.</li><li>Your App will be set up automatically.</li></ul><h4><strong>Step 2: App permissions and redirect URL</strong></h4><ul><li>In-App settings, go to <strong>User authentication</strong> settings and click edit.</li><li>In these settings, we mostly give <strong>App permissions as Read</strong> and <strong>type of App as Web.</strong></li><li>In-app info: enter <strong>callback URI</strong> as your site URL (with a specified endpoint) <a href="https://xxxxxxxx-sandbox.mxapps.io/oauth/sso/">https://xxxxxxxx-sandbox.mxapps.io/<strong>oauth/sso/</strong></a> and <strong>website</strong> <strong>URL</strong>: example as: <a href="https://xxxx-sandbox.mxapps.io/"><strong>https://xxxx-sandbox.mxapps.io/</strong></a></li><li>Before saving, check all details like in this image.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*4QlGpxU9ZW6oayy-fjclHw.png" /></figure><p><strong>Save the changes.</strong></p><h3><strong>In Mendix Studio Pro:</strong></h3><h4><strong>Step 3: Generate request token</strong></h4><p>Firstly, we need to generate a request token.</p><ul><li><strong>Create a microflow</strong> and name it GET_RequestToken.</li><li>To this microflow, <strong>add call REST activity</strong>.</li><li>In this activity, in the general tab, add <strong>the location</strong> as (‘<a href="https://api.twitter.com/oauth/request_token&#39;"><strong>https://api.twitter.com/oauth/request_token</strong>&#39;</a>).</li><li>Select the <strong>HTTP method as POST</strong>.</li><li>In the HTTP headers tab, <strong>add a new custom HTTP header</strong></li><li><strong>Key,</strong> as <strong>Authorization</strong> and value as</li></ul><pre>‘OAuth oauth_consumer_key=”(API key from developer portal)”,oauth_signature_method=”HMAC-SHA1&quot;,oauth_timestamp=”1674134493&quot;,oauth_nonce=”Cxubyo9W7V6&quot;,oauth_version=”1.0&quot;,oauth_callback=”(oauth callback URI)”,oauth_signature=”hU3G76SRcQc1sWFA8J%2BWBSrAxQU%3D”’</pre><p><strong>Example:</strong></p><pre>‘OAuth oauth_consumer_key=”XXXXXXXX”,oauth_signature_method=”HMAC-SHA1&quot;,oauth_timestamp=”1674134493&quot;,oauth_nonce=”Cxubyo9W7V6&quot;,oauth_version=”1.0&quot;,oauth_callback=”https%3A%2F%2FeventmanagmentXXXXsandbox.mxapps.io%2Foauth%2Fsso%2F”,oauth_signature=”hU3G76SRcQc1sWFA8J%2BWBSrAxQU%3D”’.</pre><ul><li>In the response handling tab, <strong>store the response in a string</strong>.</li><li>Select store in a variable as yes and name the variable as “Request Token”.</li><li>Add another activity <strong>Create Variable</strong> to this microflow.</li><li>Set d<strong>atatype as string</strong> and value as ‘<a href="https://api.twitter.com/oauth/authorize?&#39;+">https://api.twitter.com/oauth/authorize?&#39;+</a> ( variable name of REST activity).</li></ul><p><strong>Example</strong>:</p><pre>‘https://api.twitter.com/oauth/authorize?&#39;+$RequestToken</pre><ul><li>Name the variable as $<strong>HttpUrl</strong> and set this variable as a return value.</li><li>The microflow should look like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*sFLjPSW-mvwpFuRNnLboGA.png" /></figure><h4><strong>Step 4: Open the URL</strong></h4><ul><li><strong>Create a nanoflow</strong>, and name it as DS_StartWebLogin.</li><li>To this nanoflow, call the microflow <strong>GET_RequestToken</strong>.</li><li>And add <strong>open URL</strong> activity to this nanoflow(Found in Nanoflow Commons).</li><li>The nanoflow should look like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*OqmEfWbAOZDFlgcR8Q4M1g.png" /></figure><ul><li>Add a <strong>call nanoflow button</strong> to the login page and call this nanoflow from this button.</li><li>Add a caption such as: “<strong>Sign in with Twitter</strong>”.</li><li>In Icon, select the image as <strong>a Twitter logo</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*bYCGpEWOoQn0IPDDSdVemA.png" /></figure><h4><strong>Step 5: Publish REST service</strong></h4><ul><li>Next, we need to <strong>publish a REST service</strong> for the <strong>callback URL</strong>.</li><li>Right-click on your module and <strong>add a published web service</strong>.</li><li>Name the service of your choice.</li><li>To the location add <strong>OAuth/</strong> (or whatever you added in Twitter).</li><li>Add Resource as <strong>SSO</strong> (again this needs to match what was entered in Twitter).</li><li>Then <strong>add an operation</strong> for Resource, <strong>method</strong> as <strong>GET</strong>.</li><li><strong>Create a microflow</strong> for the callback.</li></ul><p>The published web service will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*o38w3Oe0-VGstIDZv51lqA.png" /></figure><ul><li>Create an Entity ‘<strong>Authorization Code</strong>’ in your Domain Model with attributes as <strong>OauthToken</strong> and <strong>OauthVerifier</strong>.</li><li>The Operations for Resource looks like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*Dp-pUWMLj5QKdTpBoCOHqw.png" /></figure><p>Add parameters as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*KEUSqBjqySUgM8SLlZDO2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*SIvU0l2OgfJJrDnxrFJrVA.png" /></figure><h3><strong>Web CALLBACK Microflow:</strong></h3><ul><li><strong>Create an object</strong> with an Authorization Code entity as shown below:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*HnRhVc54SEuA7kcUOj_6Wg.png" /></figure><ul><li>Then use the <strong>Get Application URL</strong> Java action (Community commons).</li><li>Next, call <strong>REST Service,</strong> and select the <strong>HTTP</strong> <strong>method</strong> as <strong>POST</strong>.</li><li><strong>Location</strong> ‘<a href="https://api.twitter.com/oauth/access_token?oauth_token=&#39;+$oauth_token+&#39;&amp;oauth_verifier=&#39;+$oauth_verifier">https://api.twitter.com/oauth/access_token?oauth_token=&#39;+$oauth_token+&#39;&amp;oauth_verifier=&#39;+$oauth_verifier</a>.</li><li>The <strong>response</strong> should be <strong>stored in a string</strong>.</li><li>Then we perform a <strong>split string </strong>and then<strong> </strong>using <strong>List operation</strong>s we can obtain an index for user-id,screen_name.</li><li>For Password <strong>Use Random Strong Password</strong> Java Action.</li><li>Retrieve <strong>User Rol</strong>e from <strong>System User Role</strong> as a user.</li><li>Remember to check no $Account already exists for this user by adding a Retrieve action on $Account where [Name = $user_id_name].</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*HnGPxN7iJuyioX1Yhy6KvQ.png" /></figure><ul><li><strong>Ensure the retrieved account is empty before creating a new one</strong>. Use a Decision with the statement ‘$Account! =empty’.</li><li>If it is true, it goes to the end transaction Java action.</li><li>If it is false, we can proceed and <strong>Create a new account for this use</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*WqsX_7bxPfL9zFE8fNS8Eg.png" /></figure><ul><li>Next, we need to set <strong>End Transaction and Session data.</strong></li><li>For this call Java action<strong> End Transaction</strong> as below (Community Commons)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*WloND6x-THgdYVBm3HlsSg.png" /></figure><ul><li>Then Call <strong>Set Session</strong> data Java action. Type the Input Username as shown below the image.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*Z-qbkDMV_RD5vf8ncTJrEQ.png" /></figure><ul><li>Next, we need to create the $system.HttpHeader Object as below.</li><li>Set <strong>Key</strong> as ‘<strong>Location</strong>’ and <strong>Value</strong> as <strong>$APPURL+{YourUserPage Url}</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*_fLOk0yYWwom1w5Wg3zdig.png" /></figure><p>Next, we need to change the status code as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*HRmSW0Ap4l2ZhS6AgHV4og.png" /></figure><p>Finally, your microflow should be like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-3HD6rP6wNODG30yv4xJw.png" /></figure><h4><strong>Step 6: Sign in page:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YcGM2F3Itsn7V-9sqIn-Ew.png" /></figure><ul><li>Click On Sign in with Twitter You will land on User Page.</li><li>If your configuration is successful, the user should land on the home page as an authenticated user. To ensure this setup was working, I added a data view to the home page that returns the logged-in user’s account and displayed the $Account/FullName attribute using a label.</li></ul><h4><strong>Step 7: Twitter authorization</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PJSoM1cB46fCOyHOMWbUQQ.png" /></figure><ul><li>Then Click on Authorize app. It will take you to the user page.</li></ul><p>That’s it, you’re done!</p><p>I hope it’s helpful. If you have any questions, please drop a comment below. Thanks!</p><h4>Read more</h4><ul><li><a href="https://developer.twitter.com/en/docs/twitter-api/premium/account-activity-api/guides/authenticating-users">Authenticating users</a></li><li><a href="https://developer.twitter.com/en/docs/platform-overview">Twitter Developer Platform overview</a></li><li><a href="https://docs.mendix.com/howto/integration/publish-rest-service/">Publish a REST Service</a></li></ul><p><em>From the Publisher -</em></p><p><em>If you enjoyed this article you can find more like it on our </em><a href="https://medium.com/mendix"><em>Medium page</em></a><em>. For great videos and live sessions, you can go to </em><a href="https://www.mendix.com/live/"><em>MxLive</em></a><em> or our community </em><a href="https://www.youtube.com/c/MendixCommunity/community"><em>Youtube pag</em></a><em>e.</em></p><p><em>For the makers looking to get started, you can sign up for a </em><a href="https://signup.mendix.com/link/signup/?source=direct"><em>free account</em></a><em>, and get instant access to learning with our </em><a href="https://academy.mendix.com/link/home"><em>Academy</em></a><em>.</em></p><p><em>Interested in getting more involved with our community? Join us in our </em><a href="https://join.slack.com/t/mendixcommunity/shared_invite/zt-hwhwkcxu-~59ywyjqHlUHXmrw5heqpQ"><em>Slack community channel</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7870139517fb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mendix/twitter-sso-in-mendix-using-the-twitter-api-7870139517fb">Twitter SSO in Mendix using the Twitter API</a> was originally published in <a href="https://medium.com/mendix">Mendix Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>