<?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>Forem: Nasimul Hasan Deep</title>
    <description>The latest articles on Forem by Nasimul Hasan Deep (@nasimulhasan513).</description>
    <link>https://forem.com/nasimulhasan513</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%2F442522%2F8e80e0d1-621d-4a81-b435-42b678a67795.jpeg</url>
      <title>Forem: Nasimul Hasan Deep</title>
      <link>https://forem.com/nasimulhasan513</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nasimulhasan513"/>
    <language>en</language>
    <item>
      <title>Laravel + Nuxt Authentication Made easy</title>
      <dc:creator>Nasimul Hasan Deep</dc:creator>
      <pubDate>Thu, 26 Jan 2023 14:41:19 +0000</pubDate>
      <link>https://forem.com/nasimulhasan513/laravel-nuxt-authentication-made-easy-2m1j</link>
      <guid>https://forem.com/nasimulhasan513/laravel-nuxt-authentication-made-easy-2m1j</guid>
      <description>&lt;p&gt;To build a Laravel API for Nuxt.js authentication, you can follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In your Laravel project, set up a new API route group by adding the following code to your routes/api.php file:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::middleware('auth:api')-&amp;gt;group(function () {
    // Your API routes go here
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In your Nuxt.js project, install the @nuxtjs/auth module by running the command npm install @nuxtjs/auth.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your Nuxt.js project, configure the @nuxtjs/auth module by adding the following code to your nuxt.config.js file:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;modules: [
    '@nuxtjs/auth',
],
auth: {
    strategies: {
        local: {
            endpoints: {
                login: { url: '/api/login', method: 'post', propertyName: 'access_token' },
                logout: { url: '/api/logout', method: 'post' },
                user: { url: '/api/user', method: 'get', propertyName: 'user' }
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In your Laravel project, create a new controller to handle the login and logout routes. This controller should use the Auth facade to authenticate and log out users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In your Nuxt.js project, create a new page or component to handle the login and logout functionality. This page or component should use the $auth object to authenticate and log out users.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;6.Test the authentication by running your Nuxt.js project and trying to login and logout.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
