User authentication fails in ASP.NET Core 3.0 project

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
ENRIQUEHIN
Posts: 5
Joined: Tue 09 Dec 2014 16:04

User authentication fails in ASP.NET Core 3.0 project

Post by ENRIQUEHIN » Wed 04 Dec 2019 20:17

Hi,

I started testing ASP.NET Core 3.0 and I am having trouble authenticating users. This is what I did:
  • I replaced my current version of dotConnect for PostgreSQL from 7.13.14.37 to 7.15.1519
  • I created a project with Visual Studio 2019 v16.3.9 and selected ".NET Core 3.0" and "Individual User Account" authentication.
  • I followed instructions in DevArt documentation "Using Entity Framework Core Implementation of ASP.NET Core Identity for PostgreSQL" (https://www.devart.com/dotconnect/postg ... frame.html)
  • I ran the web project.
  • I tried to login with user accounts that were already registered with an ASP.NET Core 2.2 project. I get an "Invalid login attempt" message.
  • I added a new user and tried to login and I also get an "Invalid login attempt" message.
  • I confirmed that user in previous step was added to the DB.

The result of the Packet Manager Console commands is as follows:

PM> install-package Devart.Data.PostgreSql.EFCore -Source:"https://www.nuget.org/api/v2/"
The 'Source' parameter is not respected for the transitive package management based project(s) riopoderoso.info30. The enabled sources in your NuGet configuration will be used.
Restoring packages for C:\Visual Studio 2019 Projects\riopoderoso.info30\riopoderoso.info30\riopoderoso.info30.csproj...
Installing NuGet package Devart.Data.PostgreSql.EFCore 7.15.1519.
Committing restore...
Writing assets file to disk. Path: C:\Visual Studio 2019 Projects\riopoderoso.info30\riopoderoso.info30\obj\project.assets.json
Restore completed in 136.49 ms for C:\Visual Studio 2019 Projects\riopoderoso.info30\riopoderoso.info30\riopoderoso.info30.csproj.
Successfully installed 'Devart.Data 5.0.2311' to riopoderoso.info30
Successfully installed 'Devart.Data.PostgreSql 7.15.1519' to riopoderoso.info30
Successfully installed 'Devart.Data.PostgreSql.EFCore 7.15.1519' to riopoderoso.info30
Executing nuget actions took 2.83 sec
Time Elapsed: 00:00:03.9267655

PM> update-database
Microsoft.EntityFrameworkCore.Infrastructure[10403]
Entity Framework Core 3.0.0 initialized 'ApplicationDbContext' using provider 'Devart.Data.PostgreSql.Entity.EFCore' with options: None
Microsoft.EntityFrameworkCore.Database.Command[20100]
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
select count(*)
from information_schema.tables
where (table_schema = current_schema() AND table_name = '__EFMigrationsHistory')
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
select count(*)
from information_schema.tables
where (table_schema = current_schema() AND table_name = '__EFMigrationsHistory')
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
select count(*)
from information_schema.tables
where (table_schema = current_schema() AND table_name = '__EFMigrationsHistory')
Microsoft.EntityFrameworkCore.Database.Command[20100]
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
select count(*)
from information_schema.tables
where (table_schema = current_schema() AND table_name = '__EFMigrationsHistory')
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "MigrationId", "ProductVersion"
FROM "__EFMigrationsHistory"
ORDER BY "MigrationId";
Microsoft.EntityFrameworkCore.Database.Command[20100]
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='30']
SELECT "MigrationId", "ProductVersion"
FROM "__EFMigrationsHistory"
ORDER BY "MigrationId";
Microsoft.EntityFrameworkCore.Migrations[20405]
No migrations were applied. The database is already up to date.
No migrations were applied. The database is already up to date.
Done.


I am using PostgreSQL version 11.
I will very much appreciate your feedback.

Best regards.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: User authentication fails in ASP.NET Core 3.0 project

Post by Shalex » Mon 09 Dec 2019 20:47

We cannot reproduce the issue in our environment.

Please create a brand new (empty) schema in your PostgreSQL database, set it to the Initial Schema connection string parameter, rebuild the project and run update-database again.

Does it work now?

ENRIQUEHIN
Posts: 5
Joined: Tue 09 Dec 2014 16:04

Re: User authentication fails in ASP.NET Core 3.0 project

Post by ENRIQUEHIN » Mon 16 Dec 2019 19:48

After performing tests by creating a new schema in the database and also creating a new database and schema, I could find my error. The problem was with a field called EmailConfirmed in the AspNetUsers table which was initially set to false and I missed to activate such field.

Thanks for your support and patience.

Regards,

Post Reply