<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel xmlns:media="http://search.yahoo.com/mrss/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <title>ABP.IO Stories</title>
    <link>https://abp.io/community/articles</link>
    <description>A hub for ABP Framework, .NET, and software development. Access articles, tutorials, news, and contribute to the ABP community.</description>
    <lastBuildDate>Wed, 07 Oct 2026 03:40:03 Z</lastBuildDate>
    <generator>Community - ABP.IO</generator>
    <image>
      <url>https://abp.io/assets/favicon.ico/favicon-32x32.png</url>
      <title>ABP.IO Stories</title>
      <link>https://abp.io/community/articles</link>
    </image>
    <a10:link rel="self" type="application/rss+xml" title="self" href="https://abp.io/community/rss?member=manojkumar.t%40shloklabs.com" />
    <item>
      <guid isPermaLink="true">https://abp.io/community/posts/flutter-web-authentication-from-abp-mp6l2ehx</guid>
      <link>https://abp.io/community/posts/flutter-web-authentication-from-abp-mp6l2ehx</link>
      <a10:author>
        <a10:name>manojkumar.t@shloklabs.com</a10:name>
        <a10:uri>https://abp.io/community/members/manojkumar.t@shloklabs.com</a10:uri>
      </a10:author>
      <category>flutter</category>
      <category>authentication</category>
      <title>Flutter Web Authentication From ABP</title>
      <description>How to consume Authentication with OAuth2 with abp frameworks Identity service in Flutter web.</description>
      <pubDate>Tue, 12 Apr 2022 14:26:07 Z</pubDate>
      <a10:updated>2026-10-07T01:33:19Z</a10:updated>
      <content:encoded><![CDATA[<h1>Authenticate Flutter Web Application in ABP IdentityServer</h1>
<p>In this article, we are going to see, How to use ABP authentication in Flutter Web.</p>
<p>Before further progress, I assume that you have ABP project running and flutter application running on a web version in a specific port. In my example I use <code>4200</code> as port.</p>
<p>To run flutter web application in a specific port.</p>
<pre><code>flutter run -d chrome --web-port=4200
</code></pre>
<h2>Configurations in ABP Framework</h2>
<h3>Step 1</h3>
<p>Open <code>appsettings.json</code> DbMigrator project. And In the <code>IdentityServer</code> Section. Please add the Scope.</p>
<pre><code class="language-c#">&quot;FlutterApp&quot;: {
     &quot;ClientId&quot;: &quot;FlutterApp&quot;,
     &quot;ClientSecret&quot;: &quot;1q2w3E&quot;,
     &quot;RootUrl&quot;: &quot;https://localhost:4200&quot;
   }
</code></pre>
<h3>Step 2</h3>
<p>Open <code>IdentityServerDataSeedContributor</code> inside <code>Domain\IdentityServer</code>. Under <code>CreateClientsAsync</code> function. Paste the below configuration at the end of the function.</p>
<pre><code class="language-c#">var appClientId = configurationSection[&quot;FlutterApp:ClientId&quot;];
            if (!appClientId.IsNullOrWhiteSpace())
            {
                var appRootUrl = configurationSection[&quot;FlutterApp:RootUrl&quot;].TrimEnd('/');

                await CreateClientAsync(
                  name: appClientId,
                  scopes: commonScopes,
                  grantTypes: new[] { &quot;authorization_code&quot;, &quot;client_credentials&quot; },
                  secret: configurationSection[&quot;FlutterApp:ClientSecret&quot;]?.Sha256(),
                  requireClientSecret: false,
                  redirectUri: &quot;http://localhost:4200/static.html&quot;,
                  corsOrigins: new[] { appRootUrl.RemovePostFix(&quot;/&quot;) }
                );
            }
</code></pre>
<h3>Step 3</h3>
<p>Now run the DbMigrator project. The above configuration will be updated in the database.</p>
<p>Thats all from the ABP framework side.</p>
<h2>Configurations in Flutter Web</h2>
<h3>Step 1</h3>
<p>Inside the web folder create a static html file, In this case I name it as <code>static.html</code>.</p>
<p><img src="https://raw.githubusercontent.com/manojkumart18/ABPDocs/master/Flutter%20Web%20%2B%20Abp%20Auth/img/static.PNG" alt="folder" /></p>
<pre><code class="language-html">&lt;!doctype html&gt;
&lt;html lang=&quot;en&quot;&gt;

&lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
    &lt;title&gt;Connection Succeeded&lt;/title&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;/body&gt;
&lt;script&gt;
    // Line to be noted
    window.opener.postMessage(window.location.href, '*');
&lt;/script&gt;

&lt;/html&gt;
</code></pre>
<h3>Step 2</h3>
<p>In your login file, Place a button, In the onclick trigger a function.</p>
<pre><code class="language-dart">  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
          child: MaterialButton(
        child: Text(&quot;login&quot;),
        onPressed: () {
          oAuthInit();
        },
      )),
    );
  }
</code></pre>
<h3>Step 3</h3>
<p>Install OAuth Dependency from pub. and import it in your login.dart file.</p>
<p><a href="https://pub.dev/packages/oauth2">OAUTH2 Client Library</a></p>
<pre><code class="language-dart">import 'package:oauth2_client/access_token_response.dart';
import 'package:oauth2_client/oauth2_client.dart';
import 'package:oauth2_client/oauth2_helper.dart';
</code></pre>
<h3>Step 4</h3>
<p>Now paste the below code in the Login button's onclick function. And it should be an async function.</p>
<pre><code class="language-dart">oAuthInit() async {

    final currentUri = Uri.base;
    
    final redirectUri = Uri(
      host: currentUri.host,
      scheme: currentUri.scheme,
      port: currentUri.port,
      path: '/static.html',
    );

    OAuth2Client client = OAuth2Client(
        authorizeUrl: 'https://localhost:44310/connect/authorize',
        tokenUrl: 'https://localhost:44310/connect/token',
        customUriScheme: currentUri.scheme,
        redirectUri: redirectUri.toString(),
        credentialsLocation: CredentialsLocation.HEADER,
        scopeSeparator: '+');

    OAuth2Helper oauth2Helper = OAuth2Helper(
      client,
      grantType: OAuth2Helper.AUTHORIZATION_CODE,
      clientId: 'FlutterApp',
      clientSecret: '1q2w3E',
      scopes: [
        &quot;email&quot;,
        &quot;openid&quot;,
        &quot;profile&quot;,
        &quot;role&quot;,
        &quot;phone&quot;,
        &quot;address&quot;,
        &quot;abp_angular&quot;
      ],
    );

    var tokenResponse = await oauth2Helper.getToken();

    AccessTokenResponse response = (tokenResponse as AccessTokenResponse);

    if (response.accessToken != null) {
      SharedPreferences prefs = await SharedPreferences.getInstance();

      prefs.setString(Constants.TOKEN, response.accessToken!);
    }
  }
</code></pre>
<p>Now run the application.</p>
<p><img src="https://raw.githubusercontent.com/manojkumart18/ABPDocs/master/Flutter%20Web%20%2B%20Abp%20Auth/img/result.png" alt="" /></p>
<p>Click the login button.</p>
<p><img src="https://raw.githubusercontent.com/manojkumart18/ABPDocs/master/Flutter%20Web%20%2B%20Abp%20Auth/img/result2.png" alt="" /></p>
<p>you can findout that our abp authentication service will poped up.</p>
<p>When you login with your correct credentials, it will saved in your cookies and also you can check the token is stored in the localstorage as we used shared preference.</p>
<p><img src="https://raw.githubusercontent.com/manojkumart18/ABPDocs/master/Flutter%20Web%20%2B%20Abp%20Auth/img/re.png" alt="" /></p>
<p><img src="https://raw.githubusercontent.com/manojkumart18/ABPDocs/master/Flutter%20Web%20%2B%20Abp%20Auth/img/r.png" alt="" /></p>
<p>Hurrah, Now the Authentication will work perfectly.</p>
]]></content:encoded>
      <media:thumbnail url="https://abp.io/api/posts/cover-picture-source/cf22d452-976a-e507-7336-3a033057b4b4" />
      <media:content url="https://abp.io/api/posts/cover-picture-source/cf22d452-976a-e507-7336-3a033057b4b4" medium="image" />
    </item>
    <item>
      <guid isPermaLink="true">https://abp.io/community/posts/social-media-logins-with-abp-h98jef0c</guid>
      <link>https://abp.io/community/posts/social-media-logins-with-abp-h98jef0c</link>
      <a10:author>
        <a10:name>manojkumar.t@shloklabs.com</a10:name>
        <a10:uri>https://abp.io/community/members/manojkumar.t@shloklabs.com</a10:uri>
      </a10:author>
      <category>social-external-logins</category>
      <title>Social Media Logins with ABP</title>
      <description>The Account Module has already configured to handle social or external logins out of the box. We will see each line by line progress till the end goal</description>
      <pubDate>Thu, 07 Apr 2022 18:57:41 Z</pubDate>
      <a10:updated>2026-04-26T06:06:34Z</a10:updated>
      <content:encoded><![CDATA[The Account Module has already configured to handle social or external logins out of the box. We will see each line by line progress till the end goal<br \><a href="https://shlok-devdocs.web.app/#/Examples/FeedbackManagement/Logins/SocialLogins" rel="nofollow noopener noreferrer" title="Go to the Post">Go to the Post</a>]]></content:encoded>
      <media:thumbnail url="https://abp.io/images/others/blank-cover-image-150_79.png" />
      <media:content url="https://abp.io/images/others/blank-cover-image-150_79.png" medium="image" />
    </item>
  </channel>
</rss>