<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Oren Zbeda</title>
    <description>The latest articles on DEV Community by Oren Zbeda (@orenz).</description>
    <link>https://dev.to/orenz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F768824%2F0550c1bc-b6f4-409d-8f6d-0235853f4c82.png</url>
      <title>DEV Community: Oren Zbeda</title>
      <link>https://dev.to/orenz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/orenz"/>
    <language>en</language>
    <item>
      <title>Social login made really easy</title>
      <dc:creator>Oren Zbeda</dc:creator>
      <pubDate>Sun, 05 Dec 2021 21:30:04 +0000</pubDate>
      <link>https://dev.to/orenz/social-login-made-really-easy-1ppn</link>
      <guid>https://dev.to/orenz/social-login-made-really-easy-1ppn</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;There are many social login libraries out there.&lt;br&gt;
They all require registration and are domain dependent.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;They are also hard to understand at first look.&lt;/p&gt;

&lt;p&gt;This does not have to be. &lt;/p&gt;

&lt;p&gt;We tried a different approach to social login &lt;/p&gt;

&lt;p&gt;We do all the heavy lifting and return a signed JWT.&lt;br&gt;
We also supply the npm module to verify this jwt and put the login info into the request and even the session.&lt;/p&gt;

&lt;p&gt;So how to use it:&lt;/p&gt;

&lt;p&gt;just add these lines:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const azauth=require('azauth');&lt;br&gt;
app.use(azauth.auth);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Belive it or not you are done !!!!&lt;/p&gt;

&lt;p&gt;Create your login button like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
&amp;lt;a href="http://auth.azjs.io/googleAuth/authTo/{callback url}" GOOGLE LOGIN &amp;lt;/a&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Where "{callback url}" is your website login rout (remember to encodeuricomponent this valeu)&lt;/p&gt;

&lt;p&gt;Now on your server you will get the user profile at the {callback url} on the request.azAuth.data&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get('/afterLoginCallback',  function(req,res){
    console.log(req.azAuth.data) //this holdes the user profile  
   res.send(`Hi &amp;lt;b&amp;gt; ${req.azAuth.data.emails[0].value} &amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;this all the profile info &amp;lt;br&amp;gt; ${JSON.stringify(req.azAuth.data)}` )

})

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

&lt;/div&gt;



&lt;p&gt;That is all. You are done.&lt;br&gt;
Be happy to hear what you think about it.&lt;/p&gt;

&lt;p&gt;This is a short explainer video : &lt;a href="https://github.com/orenz/azauth"&gt;https://github.com/orenz/azauth&lt;/a&gt;&lt;br&gt;
This is the git: &lt;a href="https://github.com/orenz/azauth"&gt;https://github.com/orenz/azauth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
