QuickApp: Error - Unable to Login

I’m getting the following exception when I login. The OpenIddictAuthorizations only has the colums Id, ApplicationId, Scope, Status, and Subject. Could there have been some version changes in OpenIddict?

  Activated	Event	Time	Duration	Thread
Program Output: Microsoft.EntityFrameworkCore.Database.Command:Error: Failed executing DbCommand (90ms) [Parameters=[@p0='?' (Size = 450), @p1='?' (Size = 450), @p2='?' (Size = 4000), @p3='?' (Size = 4000), @p4='?' (Size = 4000), @p5='?' (Size = 4000)], CommandType='Text', CommandTimeout='30']

SET NOCOUNT ON; INSERT INTO [OpenIddictAuthorizations] ([Id], [ApplicationId], [Scopes], [Status], [Subject], [Type]) VALUES (@p0, @p1, @p2, @p3, @p4, @p5); SELECT [Timestamp] FROM [OpenIddictAuthorizations] WHERE @@ROWCOUNT = 1 AND [Id] = @p0;

System.Data.SqlClient.SqlException (0x80131904): Invalid column name ‘Scopes’. Invalid column name ‘Type’. Invalid column name ‘Timestamp’. at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__108_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.<ExecuteAsync>d__17.MoveNext() ClientConnectionId:4563d889-c9bd-4b61-a2e2-dcec43c20bd6 Error Number:207,State:1,Class:16 63.55s

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (1 by maintainers)

Most upvoted comments

To fix the OpenIddict database errors I changed the following in Migrations 20170913022214_Initial.cs. It fixed the issue, I can now login. Not sure if there are any other attributes (nullable or not) that I might have wrong.

                name: "OpenIddictAuthorizations",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ApplicationId = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    Scopes = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Status = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Subject = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Timestamp = table.Column<string>(type: "timestamp", nullable: false),
                },

                name: "OpenIddictTokens",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ApplicationId = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    AuthorizationId = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    Ciphertext = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    End = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
                    Hash = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    Start = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
                    Status = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Subject = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
                    ExpirationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
                    Timestamp = table.Column<string>(type: "timestamp", nullable: false)
                },

I’m also getting the error Invalid column name ‘Scopes’, ‘Type’, ‘Timestamp’ on table OpenIddictAuthorizations. I uninstalled and installed Install AspNet.Security.OAth.Valivation 2.0.0-rc1-0286 (final), Changed DAL.cspfoj:

PackageReference Include="OpenIddict" Version="2.0.0-rc1-final"
PackageReference Include="OpenIddict.EntityFrameworkCore" Version="2.0.0-rc1-final"

Still get error. I drop the database after each try so it rebuilds the tables.

Code in Migrations\20170913022214_Initial.cs:
            migrationBuilder.CreateTable(
                name: "OpenIddictAuthorizations",
                columns: table => new
                {
                    Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ApplicationId = table.Column<string>(type: "nvarchar(450)", nullable: true),
                    Scope = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Status = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Subject = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },

Does this need to be changed to include the new columns?

Install AspNet.Security.OAth.Valivation 2.0.0-rc1-0286 (final) NuGet Package to resolve this issue @CybrZr00