<?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 rcmisk on Medium]]></title>
        <description><![CDATA[Stories by rcmisk on Medium]]></description>
        <link>https://medium.com/@rcmisk?source=rss-e382c066b1f5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S7c65e-FDP6CxP8hoEI8jw.jpeg</url>
            <title>Stories by rcmisk on Medium</title>
            <link>https://medium.com/@rcmisk?source=rss-e382c066b1f5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 03:13:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rcmisk/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[I stopped posting consistently for 4 weeks on X. My reach collapsed 77%.]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-snippet">February 2026: shipping hard, posting consistently. 19.6 posts/day. 16,686 impressions/day.</p><p class="medium-feed-link"><a href="https://rcmisk.medium.com/i-stopped-posting-consistently-for-4-weeks-on-x-my-reach-collapsed-77-b7d6fa8f33db?source=rss-e382c066b1f5------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://rcmisk.medium.com/i-stopped-posting-consistently-for-4-weeks-on-x-my-reach-collapsed-77-b7d6fa8f33db?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7d6fa8f33db</guid>
            <category><![CDATA[social-media]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[social-media-marketing]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Mon, 04 May 2026 20:29:18 GMT</pubDate>
            <atom:updated>2026-05-04T20:29:18.361Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Create a Dynamic Pricing Table for Your SaaS Application in Django]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/how-to-create-a-dynamic-pricing-table-for-your-saas-application-in-django-39003c8e7647?source=rss-e382c066b1f5------2"><img src="https://cdn-images-1.medium.com/max/1606/1*U7gGoYdLcCbYcBas81m_Pg.png" width="1606"></a></p><p class="medium-feed-snippet">Discover the step-by-step process to create a dynamic pricing table for your Django-based SaaS application.</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/how-to-create-a-dynamic-pricing-table-for-your-saas-application-in-django-39003c8e7647?source=rss-e382c066b1f5------2">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/how-to-create-a-dynamic-pricing-table-for-your-saas-application-in-django-39003c8e7647?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/39003c8e7647</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[django-framework]]></category>
            <category><![CDATA[django-admin]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Sat, 29 Jun 2024 21:06:14 GMT</pubDate>
            <atom:updated>2024-07-02T03:57:04.315Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Webflow to Django: Template Preparation Guide]]></title>
            <link>https://rcmisk.medium.com/how-to-prepare-webflow-template-files-for-django-templates-76743358c3c6?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/76743358c3c6</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[webflow]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Wed, 29 May 2024 02:37:33 GMT</pubDate>
            <atom:updated>2024-05-29T02:44:52.971Z</atom:updated>
            <content:encoded><![CDATA[<p>I love Webflow for designing UI, and I love Django for developing REST API’s. I wanted to try combining the two.</p><p>I have a project in Django where I give the user the ability to create their own SaaS landing page based off a set of template choices (all designed in Webflow).</p><p>In order to design your landing page in Webflow and then export and bring into Django you need to first hit the export code button in Webflow like so:</p><ol><li>First hit button in the top right corner as shown below:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RbMr65bfDPDd-XhhW0BCqw.png" /></figure><p>2. Then hit prepare zip and download the files as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEDzf9qfv1Vq9mcOD9pV6Q.png" /></figure><p>3. Now you have all of your files from you landing page on your local machine.</p><p>4. Next, copy the folder into a location inside your Django project. I made a directory called webflow-templates and placed the files and folders (index.html, css, js, images) into another folder called landingpage_option1</p><p>5. Make sure this folder landingpage_option1 is referenced in the scripts below.</p><p>6. On my local machine I then pip install beautifulsoup4</p><p>7. This is used in the scripts to parse the html files.</p><p>8. I then created a scripts folder that contains 2 python scripts which are below.</p><p>9. Run move_exported_dirs_files.py</p><pre>#!/usr/bin/env python3.8.3<br>import os<br>import shutil<br><br># moving html files into templates<br>target_dir = &quot;../templates/landingpage_option1/&quot;<br>source_dir = &quot;../webflow-templates/landingpage_option1&quot;<br>print(&quot;Source: &quot; + source_dir)<br>files = os.listdir(source_dir)<br>print(&quot;Files in source directory: &quot; + source_dir)<br>files_html = [i for i in files if i.endswith(&quot;.html&quot;)]<br>os.makedirs(os.path.dirname(target_dir), exist_ok=True)<br>for file in files_html:<br>    print(&quot;Moving: &quot; + os.path.join(source_dir, file))<br>    print(&quot;To: &quot; + os.path.join(source_dir, file))<br>    shutil.copy(os.path.join(source_dir, file), target_dir)<br><br># moving css, images, js folders<br>target_dir = &quot;../static_files/landingpage_option1/&quot;<br>source_dir = &quot;../webflow-templates/landingpage_option1&quot;<br>sub_dirs = [&quot;css&quot;, &quot;images&quot;, &quot;js&quot;]<br>list_dirs = os.listdir(source_dir)<br>for sub_dir in list_dirs:<br>    if sub_dir in sub_dirs:<br>        dir_to_copy = os.path.join(source_dir, sub_dir)<br>        target_sub_dir = os.path.dirname(target_dir + sub_dir + &quot;/&quot;)<br>        shutil.copytree(dir_to_copy, target_sub_dir)</pre><p>10. This will take the files from webflow-templates/landingepage_option1 and move the index.html into your Django templates folder (make sure this is created if not already) templates/landingepage_option1 folder inside Django</p><p>11. It then also moves all sub folders (css, js, images) into your static_files folder (or where ever you house your static files) into a folder called static_files/landingpage_option1</p><p>12. Run find_and_replace.py</p><pre>#!/usr/bin/env python3<br><br># add django static tags to index.html file<br>from bs4 import BeautifulSoup as bs<br><br># append load static<br>with open(&quot;../templates/landingpage_option1/index.html&quot;, &quot;r+&quot;) as file:<br>    html = file.read()<br>    file.seek(0, 0)<br>    file.write(&quot;{% load static %}\n&quot; + html)<br># replace all href links<br>with open(&quot;../templates/landingpage_option1/index.html&quot;) as in_file:<br>    html = in_file.read()<br>    soup = bs(html, &quot;html.parser&quot;)<br>    for link in soup.findAll(&quot;link&quot;):<br>        beg = &quot;{% static &#39;landingpage_option3/&quot;<br>        end = &quot;&#39; %}&quot;<br>        link[&quot;href&quot;] = beg + link[&quot;href&quot;] + end<br>        # {% static &#39;css/normalize.css&#39; %}<br>with open(&quot;../templates/landingpage_option1/index.html&quot;, &quot;w&quot;) as out_file:<br>    out_file.write(str(soup))<br><br># # replace all src in img tags<br>with open(&quot;../templates/landingpage_option1/index.html&quot;) as in_file:<br>    html = in_file.read()<br>    soup = bs(html, &quot;html.parser&quot;)<br>    for img in soup.findAll(&quot;img&quot;):<br>        beg = &quot;{% static &#39;landingpage_option3/&quot;<br>        end = &quot;&#39; %}&quot;<br>        img[&quot;src&quot;] = beg + img[&quot;src&quot;] + end<br>        # {% static &#39;css/normalize.css&#39; %}<br>with open(&quot;../templates/landingpage_option1/index.html&quot;, &quot;w&quot;) as out_file:<br>    out_file.write(str(soup))<br><br># # replace all src in script tags from webflow<br>with open(&quot;../templates/landingpage_option1/index.html&quot;) as in_file:<br>    html = in_file.read()<br>    soup = bs(html, &quot;html.parser&quot;)<br>    script = soup.find(&quot;script&quot;, src=&quot;js/webflow.js&quot;)<br>    beg = &quot;{% static &#39;landingpage_option1/&quot;<br>    end = &quot;&#39; %}&quot;<br>    script[&quot;src&quot;] = beg + script[&quot;src&quot;] + end<br><br>with open(&quot;../templates/landingpage_option1/index.html&quot;, &quot;w&quot;) as out_file:<br>    out_file.write(str(soup))</pre><p>13. This script will replace all your referenced static folders and files with the Django template static tags. This will add {% load static %} to the top of your index.html file in the templates folder as well as add static tags to all your &lt;link href ’s as well as your &lt;script src=”{% static ‘landingpage_option1/js/webflow.js’ %}” type=”text/javascript”&gt;&lt;/script&gt;</p><p>14. You should be ready to go to see your new template rendering if you have a view in Django pointing to the template. Something like this views.py</p><pre>from django.shortcuts import render<br><br>def index(request):<br> return render(request, &quot;landingpage_option1/index.html&quot;, context)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76743358c3c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to make a request to Notion API using Python]]></title>
            <link>https://rcmisk.medium.com/how-to-make-a-request-to-notion-api-using-python-935ee500ace6?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/935ee500ace6</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[notion]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Thu, 23 May 2024 18:38:34 GMT</pubDate>
            <atom:updated>2024-05-23T19:29:40.202Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xSIFPNkC467lVuNC.png" /></figure><p>Below is a Python script that uses the requests library to interact with the Notion API and read a specific page. This script automates the process described earlier.</p><h3>Prerequisites:</h3><ol><li><strong>Notion Account</strong>: Ensure you have a Notion account and a page you want to read.</li><li><strong>API Token</strong>: Obtain an integration token from Notion by creating an integration at <a href="https://www.notion.so/my-integrations">Notion Integrations</a>.</li><li>Install the requests library if you haven&#39;t already:</li></ol><pre>pip install requests</pre><h3>Python Script:</h3><pre>import requests<br><br>def get_notion_page(page_id, token):<br>    url = f&quot;&lt;https://api.notion.com/v1/pages/{page_id}&gt;&quot;<br><br>    headers = {<br>        &quot;Authorization&quot;: f&quot;Bearer {token}&quot;,<br>        &quot;Notion-Version&quot;: &quot;2022-06-28&quot;,<br>        &quot;Content-Type&quot;: &quot;application/json&quot;<br>    }<br><br>    response = requests.get(url, headers=headers)<br><br>    if response.status_code == 200:<br>        print(&quot;Page details:&quot;)<br>        print(response.json())<br>    else:<br>        print(f&quot;Failed to retrieve page. Status code: {response.status_code}&quot;)<br>        print(response.text)<br><br>if __name__ == &quot;__main__&quot;:<br>    # Replace these variables with your actual values<br>    page_id = &quot;your_page_id&quot;<br>    token = &quot;your_integration_token&quot;<br><br>    get_notion_page(page_id, token)</pre><h3>How to Use:</h3><ol><li>Replace &quot;your_page_id&quot; with the actual ID of the Notion page you want to read.</li><li>Replace &quot;your_integration_token&quot; with your actual Notion integration token.</li><li>Run the script.</li></ol><h3>Running the Script:</h3><p>Save the script to a file, for example notion_read_page.py, and run it using Python:</p><pre>python notion_read_page.py</pre><p>The script will send a GET request to the Notion API and print the details of the specified page.</p><p><strong><em>Written with the help of Gen AI!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=935ee500ace6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launching IdeaVerify to Streamline Idea Validation — My #BuildInPublic Journey — episode 1]]></title>
            <link>https://python.plainenglish.io/launching-ideaverify-to-streamline-idea-validation-my-buildinpublic-journey-episode-1-b972ad8fe0c4?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b972ad8fe0c4</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[ideation]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[build-in-public]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 10:23:16 GMT</pubDate>
            <atom:updated>2024-03-20T01:36:33.294Z</atom:updated>
            <content:encoded><![CDATA[<h3>Launching IdeaVerify to Streamline Idea Validation — My #BuildInPublic Journey — episode 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5f8N1-_3HPMo0kLNitlf0g.jpeg" /></figure><h3>Introduction</h3><p>I’m finally going to start my #buildinpublic journey! On the journey you will see how I came across a problem, how I chose to solve it and finally how to launch! Each week I’ll post what I’ve worked on and share what I built, so others can learn along the way. Let’s get started!</p><h3>The Genesis:</h3><p>My coding adventure began as an attempt to bring my brother’s vision for a college-centric social network to life. Despite months of development and launching with an initial user base, the lack of market validation led to its stagnation. This pivotal experience highlighted the crucial step we missed — validating the idea before fully committing to its development.</p><h3>The Awakening:</h3><p>Fast forward to the present, I’ve recognized a recurring pattern in my approach to projects — a cycle of enthusiasm followed by a realization of misalignment with market needs. This realization sparked the concept of ‘IdeaVerify’, a meta-solution born from the lessons learned throughout my journey.</p><p>Below is the manual process I did to test out this idea:</p><ol><li>Came up with a solution to a problem.</li><li>I built a simple landing page describing the problem and the solution.</li><li>I described the features, services, and prices with CTA’s like Signup Now, or Subscribe now etc. All of the Purchase Now CTA’s would not actually allow the user to purchase the SaaS but would show the user to sign up for a waitlist.</li><li>I then took that static page and deployed it on places for free like <a href="https://www.netlify.com/">Netlify</a> or <a href="https://www.render.com/">Render</a></li><li>The only thing I had to pay for to make it look legit was a Domain address, and to do that I would go to <a href="https://www.namecheap.com/">Namecheap</a> to purchase a cheap domain.</li><li>Once created I published it to channels like Reddit, Twitter, Quora, Linkedin, Facebook and showed it to users of whom I thought would benefit.</li><li>I then analyzed what type of interest I got and from there I made a decision if it’s worth it to build.</li></ol><p>This is how I came up with Ideaverify! I actually went through the entire <em>manual</em> process above and got a lot of interest by just posting on one or two subreddits on Reddit. I got signups, and messages saying that it was real interesting and that people were wondering when it would be ready.</p><p>This is how Ideaverify was born. I wanted to automate this entire process of validating or verifying an idea. It would automate all of the above, all at the click of a button but also provide analytics and a “go or no go” decision.</p><p>In this #buildinpublic series I will be using my <a href="https://boilerplate.rcmisk.com/">boilerplate.rcmisk.com</a> SaaS starter kit built in Django and React with all the common SaaS features: transactional emails w/ Postmark, Stripe for payments/subscriptions, Google Analytics, dynamic landing page and copy creation, blog, user login/registration flows, Material UI for styling and deployment to Render.</p><p>I’m going to break up this project into different parts, and milestones and show the code, learnings and development along the way!</p><h3>Milestone 1</h3><ol><li>Allow user to input what their SaaS is all about and then generate a landing page based off the copy the user provided and different template styles</li><li>Automatically create a google analytics app pointing to the url for tracking</li><li>User clicks “Create” and behind the scenes deploy the static landing page pointing to a unique URL associated with <a href="http://ideaverify.com/">ideaverify.com</a> subdomain. i.e. <a href="http://my-new-idea.ideaverify.com/">my-new-idea.ideaverify.com</a></li><li>Allow user to update copy, images, and style once it’s deployed</li></ol><h3>Milestone 2</h3><ol><li>Allow user to pick niche subreddits on Reddit and post to from within the ideaverify dashboard.</li><li>Show top subreddits/posts on Reddit to post to based off key words that their SaaS is associated with.</li></ol><h3>Milestone 3</h3><ol><li>Allow user to point it to their custom domain</li></ol><p>This I believe will be a good MVP and stopping place to launch Ideaverify!</p><p>Follow me here:</p><p><a href="https://rcmisk.com/">rcmisk.com</a></p><p><a href="https://twitter.com/rcmisk">https://twitter.com/rcmisk</a></p><p><a href="https://www.indiehackers.com/rcmisk">https://indiehackers.com/rcmisk</a></p><p><a href="https://dev.to/rcmisk">https://dev.to/rcmisk</a></p><p>Sign up for my <a href="https://rcmisk.com/newsletter">newsletter</a> to keep track of my progress and to learn along the way!</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a><strong> | </strong><a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://stackademic.com/"><strong>Stackademic</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b972ad8fe0c4" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/launching-ideaverify-to-streamline-idea-validation-my-buildinpublic-journey-episode-1-b972ad8fe0c4">Launching IdeaVerify to Streamline Idea Validation — My #BuildInPublic Journey — episode 1</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Django and React SaaS Boilerplate]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/django-and-react-saas-boilerplate-40b003c2be40?source=rss-e382c066b1f5------2"><img src="https://cdn-images-1.medium.com/max/2600/0*jh1xy1l8mnrSqYut" width="2600"></a></p><p class="medium-feed-snippet">Starting a Software as a Service (SaaS) project can be daunting, especially with the initial setup of the infrastructure.</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/django-and-react-saas-boilerplate-40b003c2be40?source=rss-e382c066b1f5------2">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/django-and-react-saas-boilerplate-40b003c2be40?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/40b003c2be40</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[django-rest-framework]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[stripe]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Tue, 12 Mar 2024 01:38:15 GMT</pubDate>
            <atom:updated>2024-03-14T01:19:57.782Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Coming soon — How to create a SaaS boilerplate written in Django and React]]></title>
            <link>https://rcmisk.medium.com/coming-soon-how-to-create-a-saas-boilerplate-written-in-django-and-react-fffc0fc3f298?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/fffc0fc3f298</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[django-rest-framework]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[material-ui]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 04:15:04 GMT</pubDate>
            <atom:updated>2024-02-29T04:15:04.277Z</atom:updated>
            <content:encoded><![CDATA[<h3>Coming soon — How to create a SaaS boilerplate written in Django and React</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBxC6glTipyV8p0pJpAzHQ.png" /></figure><p>Finally finished my SaaS boilerplate written in Django and React! Check it out here: <a href="https://boilerplate.rcmisk.com/">https://boilerplate.rcmisk.com</a></p><p>I realized when I had an idea for a SaaS or business I kept creating the same basic features, login/register, user management, JWT tokens, authentication, landing pages, profiles, Stripe integration, email, styling, Material UI, React, Google Analytics etc.</p><p>I thought there must be a smarter way. So I took the time coding up all those features and bundling them up into a repo so I can simply git clone and start immediately coding up my idea. No more wasted effort on re-creating the wheel each time. The repo is super generic so all I have to do is change the copy, colors, icons, and name of idea!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFK1n4zta6sUiYlrs-AZRA.png" /></figure><p>I’ll be starting up some blog post series on how I went about coding this up in Django and React and all the integrations that I set it up with.</p><p>Feel free to leave feedback!</p><p>Posts coming soon! Excited to share! #buildinpublic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fffc0fc3f298" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Authenticate user via Facebook and generate a JWT token via Django Rest Framework]]></title>
            <link>https://python.plainenglish.io/authenticate-user-via-facebook-and-generate-a-jwt-token-via-django-rest-framework-c36fb84a3d9c?source=rss-e382c066b1f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/c36fb84a3d9c</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[jwt-token]]></category>
            <category><![CDATA[facebook]]></category>
            <category><![CDATA[django-rest-framework]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[rcmisk]]></dc:creator>
            <pubDate>Sat, 11 Jul 2020 21:15:03 GMT</pubDate>
            <atom:updated>2024-06-30T20:19:35.067Z</atom:updated>
            <content:encoded><![CDATA[<h3>Authenticate the User via Facebook and Generate a JWT Token via Django Rest Framework</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2tNIwoyU4ManX5Vd" /><figcaption>Photo by <a href="https://unsplash.com/@konkarampelas?utm_source=medium&amp;utm_medium=referral">Kon Karampelas</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’m trying to build a server side application that will authenticate users via Facebook for what ever client side apps I want to develop.</p><p>I was hoping to be able to simply authenticate users via Facebook from either an iOS/Android React Native app and/or React web app without having to use a ton of other python libraries.</p><p>Here are some helpful tutorials/links that helped me achieve this. Thank you!:</p><ul><li><a href="https://medium.com/@gerrysabar/implementing-google-login-with-jwt-in-django-for-restful-api-authentication-eaa92e50522d">Implementing Google Login With JWT in Django for RESTful API Authentication</a></li><li><a href="https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow">Manually Build a Login Flow - Facebook Login - Documentation - Facebook for Developers</a></li></ul><h3>Let’s first set up the Django app</h3><pre>cd projects</pre><pre>mkdir app-login-test</pre><pre>cd app-login-test</pre><pre>python -m venv env</pre><pre>source env/bin/activate</pre><pre>pip install django djangorestframework djangorestframework-simplejwt</pre><p>Set the ‘rest_framework’ in settings.py under INSTALLED_APPS as well as add this for authenticating with JWT:</p><pre>REST_FRAMEWORK = {</pre><pre>    &quot;DEFAULT_AUTHENTICATION_CLASSES&quot;: [</pre><pre>        &quot;rest_framework_simplejwt.authentication.JWTAuthentication&quot;,</pre><pre>    ],</pre><pre>}</pre><p>Now let’s run server:</p><pre>python manage.py makemigrations</pre><pre>python manage.py migrate</pre><pre>python manage.py runserver</pre><h3>Now let’s set up our developer’s Facebook App</h3><p>You can se that up here:</p><p><a href="https://developers.facebook.com/apps/">https://developers.facebook.com/apps/</a></p><ol><li>Create App -&gt; then create test app by hovering over top right corner</li><li>Record the AppID and App Secret from Settings -&gt; Basic</li><li>You shouldn’t have to add and URL’s when working on localhost/dev</li></ol><h3>Now we want to build the login dialog url</h3><p>This is the link the user will be taken to when the user clicks the Login In Via Facebook button on what ever sign ui screen you create:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*YhKGsdi660mtkec6WnlJWA.png" /></figure><pre>https://www.facebook.com/v7.0/dialog/oauth?client_id={app-id}&amp;redirect_uri=http://localhost:8000/login&amp;scope=email</pre><pre>--&gt; {app-id} is the app id you recorded from above from your facebook app.<br>--&gt; scope is the type of permission you want to have access to<br>--&gt; redirect uri is where you want this login link to be taken to after successful login... in this example we are going to redirect it to our api endpoint /login/</pre><pre>Keep this url so that you can use it to login via the web browser</pre><p>Scope is a comma or space separated list of Permissions to request from the person using your app.</p><p><a href="https://developers.facebook.com/docs/facebook-login/permissions/">Reference - Facebook Login - Documentation - Facebook for Developers</a></p><p>Once successful login Facebook then creates a `code` which is a long random hash and it’s passed via the redirect uri with the param :</p><pre>http://localhost:8000/login?code={code-generated-from-above-result}</pre><h3>Now back into Django</h3><pre># create login app<br>python manage.py startapp login</pre><p>In the login app create a views.py with the below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e03c7644a066ba968a01f8f19cb2b7e/href">https://medium.com/media/8e03c7644a066ba968a01f8f19cb2b7e/href</a></iframe><p>Add the views into the urls.py in your main app in Django</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0317c92b5f565b0bd85795a267ece16/href">https://medium.com/media/b0317c92b5f565b0bd85795a267ece16/href</a></iframe><p>#1 First go to login screen for facebook:</p><p>https://www.facebook.com/v7.0/dialog/oauth?client_id={FACEBOOK_APP_ID}&amp;redirect_uri=http://localhost:8000/login/&amp;state={&quot;{st=state123abc,ds=123456789}&quot;}&amp;scope=email</p><p>The above returns `code` param → then redirects to OUR /login?code={code-generated-from-facebook}</p><h3>Walking through what the SignInView does</h3><p>Once the app is redirected to the SignInView /login?code={code-from-facebook-after-success-login} we generate a payload with the required info in order to build the below url and try to grab the user’s access token. We take the code param from the #1 url above.</p><p>#2 <a href="https://graph.facebook.com/v7.0/oauth/access_token?client_id=1415988338584764&amp;redirect_uri=http://localhost:8000/login/&amp;client_secret={app_secret}&amp;code={code-generated-from-above-result}">https://graph.facebook.com/v7.0/oauth/access_token?client_id=1415988338584764&amp;redirect_uri=http://localhost:8000/login/&amp;client_secret={app_secret}&amp;code={code-generated-from-above-result}</a></p><p>URL # 2 is what generates the access token and the response below:</p><pre>{</pre><pre>    “access_token”: “{users_access_token}”,</pre><pre>    “token_type”: “bearer”,</pre><pre>    “expires_in”: 5181851</pre><pre>}</pre><p>Store the user_access_token for use later on.</p><p>We then want to grab our (the developer’s access token in order to make requests to fetch user’s info as well as to inspect/debug the users_access_token to make sure it’s valid). Create payload which will then generate url #3 below.</p><p>#3 <a href="https://graph.facebook.com/oauth/access_token?client_id={your-app-id}&amp;client_secret={your-app-secret}&amp;grant_type=client_credentials">https://graph.facebook.com/oauth/access_token?client_id={your-app-id}&amp;client_secret={your-app-secret}&amp;grant_type=client_credentials</a></p><p>Here’ is a successful response from the above url:</p><pre>{</pre><pre>    “access_token”: “{developers-app-access-token}”,</pre><pre>    “token_type”: “bearer”</pre><pre>}</pre><p>Now inspect the users access token → validate to make sure it’s still valid. Build payload so that we can build and hit the below url #4.</p><p>#4 <a href="https://graph.facebook.com/debug_token?input_token={token-to-inspect}&amp;access_token={app-token-or-admin-token}">https://graph.facebook.com/debug_token?input_token={token-to-inspect-or-users-access-token}&amp;access_token={app-token-or-admin-token-developer’s-access-token-from-above}</a></p><pre>{</pre><pre>“data”: {</pre><pre>“app_id”: “appid1234567”,</pre><pre>“type”: “USER”,</pre><pre>“application”: “Example Test App”,</pre><pre>“data_access_expires_at”: 1602126624,</pre><pre>“expires_at”: 1599532509,</pre><pre>“is_valid”: true,</pre><pre>“issued_at”: 1594348509,</pre><pre>“scopes”: [</pre><pre>“public_profile”</pre><pre>],</pre><pre>“user_id”: “user-id123456”</pre><pre>}</pre><pre>}</pre><p>Valid user_access_token ^^^^ and gives us access to the user_id</p><p>Now we want to get user info more specifically the email address so that we can create or check if user exists. We can do that by building another payload and hitting the url #5 below. Fields are the user fields you want access to (the permissions you added in the scope way up top!).</p><p>#5 <a href="https://graph.facebook.com/%7Buser_id%7D?fields=id,name,email&amp;access_token={user_access_token}">https://graph.facebook.com/{user_id}?fields=id,email&amp;access_token={user_access_token}</a></p><p>Then what the view does is checks if there is a user already in our DB with the email address. If not it will generate a new user with that email address and random password.</p><p>It then will generate a JWT token using RefreshToken .</p><p>And we can pass the response back.</p><pre>token = RefreshToken.for_user(user) </pre><pre>response = {}</pre><pre>response[&quot;username&quot;] = user.username</pre><pre>response[&quot;access_token&quot;] = str(token.access_token)</pre><pre>response[&quot;refresh_token&quot;] = str(token)</pre><p>We now have successfully authenticated a user and generated a JWT token that can be returned to any type of client whether that be React-Native or React. Once the client receives that JWT token we want to store that on client side securely and safely. In React-Native i believe the best way to do that is in here:</p><p><a href="https://docs.expo.io/versions/latest/sdk/securestore/">SecureStore - Expo Documentation</a></p><p>If you are using Expo.</p><p>You can also make your /hello/endpoint require authentication so that you can test if your JWT token is working!</p><p>#6 test auth for endpoint</p><pre>curl -X GET <a href="http://localhost:8000/hello/">http://localhost:8000/hello/</a> -H ‘Authorization: Bearer access_token_here’</pre><p>This is just a test app to get Facebook oauth flow working. Thank you to</p><p><a href="https://medium.com/@gerrysabar/implementing-google-login-with-jwt-in-django-for-restful-api-authentication-eaa92e50522d">Implementing Google Login With JWT in Django for RESTful API Authentication</a></p><p>for helping me see how to do it for Google login!</p><p>Next I will be trying to set up React-Native and creating iOS and Android Login Screens that will contain this Facebook login button… and logging in and out users and allowing them to go to a private home screen that requires authentication to view! FYI → Postman was also very helpful in seeing what the facebook graph requests returned!</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a><strong> | </strong><a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://stackademic.com/"><strong>Stackademic</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a><strong> | </strong><a href="https://blog.cubed.run/"><strong>Cubed</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c36fb84a3d9c" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/authenticate-user-via-facebook-and-generate-a-jwt-token-via-django-rest-framework-c36fb84a3d9c">Authenticate user via Facebook and generate a JWT token via Django Rest Framework</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>