Search code examples
asp.net-coreasp.net-identityopeniddict

"Invalid object name 'OpenIddictAuthorizations'." - OpenIddict/.Net Core Identity Error


I am new to .Net Core 2.0 and Identity framework. I am trying to use OpenIddict in the project. References: OpenIddict (2.0.0-rc1-final) OpenIddict.EntityFrameworkCore(2.0.0-rc1-final) Microsoft.AspNetCore.Identity.EntityFrameworkCore (2.0.1) I keep on getting the following runtime error: Invalid object name 'OpenIddictAuthorizations'.

Here is the stack trace:

at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__108_0(Task`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.<ExecuteAsync>d__17.MoveNext()

--- 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.Update.ReaderModificationCommandBatch.<ExecuteAsync>d__32.MoveNext()

It looks like a SQL exception but I am not sure why it is looking for an object called OpenIddictAuthorizations in the database. Any help is highly appreciated.


Solution

  • Because you need this Table in your Db beside other tables

    dbo.OpenIddictApplications
    dbo.OpenIddictAuthorizations
    dbo.OpenIddictScopes
    dbo.OpenIddictTokens
    

    So, OpenId can store the tokens and verify them.