Closed sp00ky closed 6 years ago
Same problems here, and some other weird things happening when I try to publish. Whilst in debug the app starts, when trying to publish via cli I get errors:
error CS1061: 'AuthenticationBuilder' does not contain a definition for 'AddOAuthValidation' and no extension method 'AddOAuthValidation' accepting a first argument of type 'AuthenticationBuilder' could be found (are you missing a using directive or an assembly reference?)
Install AspNet.Security.OAth.Valivation 2.0.0-rc1-0286 (final) NuGet Package to resolve this issue @CybrZr00
thanks, seems I had 2 entries in my csproj removing the ref to the old version has fixed it.
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(type: "nvarchar(450)", nullable: false), ApplicationId = table.Column (type: "nvarchar(450)", nullable: true), Scope = table.Column (type: "nvarchar(max)", nullable: true), Status = table.Column (type: "nvarchar(max)", nullable: true), Subject = table.Column (type: "nvarchar(max)", nullable: true) },
Does this need to be changed to include the new columns?
I am trying to host the application in IIS and I getting the following error in the chrome console when I try to login. I deployed the application to a folder name Sample and created a IIS application with name Sample. Not sure why it is trying to access from C:\Inetpub\wwwroot.
How do I fix it? Thank you
Error:
After Troubleshooting:
window.location.origin is coming as "http://localhost:8080/" and path as "sample/login" instead of http://localhost:8080/sample as the baseUrl.
Utiliites.ts public static baseUrl() { if (window.location.origin) return window.location.origin
return window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
}
Am I missing any setting that lets me get the baseUrl correctly?
Thank you
@speddi Looks like an IIS setup issue. This isn't really the place for help with that.
@garyhoff1 I was thinking that, I tried adding the columns manually, but couldn't get the Timestamp column to work, I only tried DateTime and timestamp types and gave up.
@CybrZr00 This might be an IIS issue but it will be a problem anytime we create an application in IIS and deploy the code to that application. Does this not support deploying the app to a application under Default Web Site like 'Default Web Site/MyApp'
This issue is for what spooky has pointed out in the OP. Maybe open a new issue?
@CybrZr00 got it. I opened a new ticket. Thank you.
As a horrible hack, I added the missing columns manually (changed scope to scopes) I set all the data types to NVARCHAR(MAX) also added Timestamp to OpeniddictTokens also as NVARCHAR.
I have noticed that entries into the tables are missing an ApplicationId and Timestamp so despite this hack appearing to work, there is data missing.
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(type: "nvarchar(450)", nullable: false), ApplicationId = table.Column (type: "nvarchar(450)", nullable: true), Scopes = table.Column (type: "nvarchar(max)", nullable: true), Status = table.Column (type: "nvarchar(max)", nullable: true), Subject = table.Column (type: "nvarchar(max)", nullable: true), Type = table.Column (type: "nvarchar(max)", nullable: true), Timestamp = table.Column (type: "timestamp", nullable: false), }, name: "OpenIddictTokens", columns: table => new { Id = table.Column (type: "nvarchar(450)", nullable: false), ApplicationId = table.Column (type: "nvarchar(450)", nullable: true), AuthorizationId = table.Column (type: "nvarchar(450)", nullable: true), Ciphertext = table.Column (type: "nvarchar(max)", nullable: true), End = table.Column (type: "datetimeoffset", nullable: true), Hash = table.Column (type: "nvarchar(450)", nullable: true), Start = table.Column (type: "datetimeoffset", nullable: true), Status = table.Column (type: "nvarchar(max)", nullable: true), Subject = table.Column (type: "nvarchar(max)", nullable: true), Type = table.Column (type: "nvarchar(max)", nullable: true), CreationDate = table.Column (type: "datetime2", nullable: false), ExpirationDate = table.Column (type: "datetime2", nullable: true), Timestamp = table.Column (type: "timestamp", nullable: false) },
@garyhoff1: Confirmed!
At OpenIddictAuthorizations it has to be
Scopes = table.Column(type: "nvarchar(max)", nullable: true),
the s was missing and the other additions are also necessary ^^
I'm sure this is an embarrassingly newbie question...but I made the changes to the migration, but they don't seem to be having any effect. Do I have to do something to drop the tables for the migration to recreate them? Any insight would be greatly appreciated.
I went into Microsoft SQL Server Management Studio and deleted the entire database, and added back a new empty database with the same name (using right mouse click options). That should do it.
There is currently open pull request from HansHammel that should resolve this issue
This is a misunderstood on the origin of your problem. I think if you have this error it's because you have updated the version of OpenIddict, and this library has a different database schema that the oldest version included in QuickApp. Remember that QuickApp is using EF code first, this means that the code is updating the database. To solve this, you have to create a new EF migration and absolutely not change the existing migration! Open NuGet Package Manager Console and enter Add-Migration "OpenIddictV2" This will generate a new migration step, and the next execution of your application will use it to update your database. "OpenIddictV2" is just the name of your migration. Each time you change your EF models, you should ask for a new corresponding migration
It appears you're using a newer/different version of OpenIddict that has different database schema. Like @nicocomumu suggested, you'll need to apply a new EF migrations to update the database properly. Manually updating the db is not the right way.
Closing this thread. If this is still an issue please reopen.
I think the problem related to https://github.com/openiddict/openiddict-core/pull/504/commits/37e24a5e76e46addf2cc103e47bf119e4c2c87fb still not solved
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?
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.b__108_0(Taskd__17.MoveNext()
ClientConnectionId:4563d889-c9bd-4b61-a2e2-dcec43c20bd6
Error Number:207,State:1,Class:16 63.55s
1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask
2.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.