Skip to content

cannot login into Ombi using Plex account #4232

@abendel

Description

@abendel

Describe the bug
Whenever I/Users try to login into Ombi (on a web page, works fine on computer/ IOS app) using plex authentication it says "you have successfully signed in. You may now close the window. The window, doesn't auto close and it doesn't log into ombi.
To Reproduce
Steps to reproduce the behavior:

  1. "sign in with Plex"
  2. Sign in
  3. Wait for autoclose, which doesnt.
  4. "cannot log you in"

Expected behavior
The Plex window auto closes and logs me in
Screenshots

Logs (Logs directory where Ombi is located)
If applicable, a snippet of the logs that seems relevant to the bug if present.

Desktop (please complete the following information):

  • OS: Windows 10

Ombi Version (please complete the following information):

  • Version 4.0.1425
  • Media Server Plex
  • Database Type: SQLite (Please change if using MySQL)

Additional context
Love Ombi, but please help|!

Activity

ombi-bot

ombi-bot commented on Jun 22, 2021

@ombi-bot
Contributor

Hi!
Thanks for the issue report. Before a real human comes by, please make sure you used our bug report format.
Have you looked at the wiki yet? https://docs.ombi.app/
Before posting make sure you also read our FAQ.
Make the title describe your issue. Having 'not working' or 'I get this bug' for 100 issues, isn't really helpful.
If we need more information or there is some progress we tag the issue or update the tag and keep you updated.
Thanks!
Ombi Bot.

tidusjar

tidusjar commented on Jun 22, 2021

@tidusjar
Member

On the user management page, with the user guy are trying to login, does it state the user is a Plex user or local user?

abendel

abendel commented on Jun 22, 2021

@abendel
Author
pyarmak

pyarmak commented on Jun 24, 2021

@pyarmak

My plex oauth also broke after updating to V4. I tried a clean config (using docker) and even in the wizard, the oauth login with plex does not work while the request token button worked great. Seems to be an issue with oauth. I checked the logs and there was nothing useful there.

baemien

baemien commented on Jun 25, 2021

@baemien

Same exact issue here, tried on mobile and PC with the same results. Thought it may have been a cache issue so followed this commenters advice but it did not resolve the issue.

tidusjar

tidusjar commented on Jun 25, 2021

@tidusjar
Member

So when the Plex OAuth window pops up and it states "You can now close this window" are you closing it?

Because Ombi will trigger once that window is closed

pyarmak

pyarmak commented on Jun 25, 2021

@pyarmak

So when the Plex OAuth window pops up and it states "You can now close this window" are you closing it?

Because Ombi will trigger once that window is closed

@tidusjar Yes, window closes, button does a spinner, notification pops up saying auth failed.

image

Logs (turned up logging to Information):

info: System.Net.Http.HttpClient.OmbiClient.LogicalHandler[100]


      Start processing HTTP request GET https://plex.tv/api/v2/pins/[DIGITS]


info: System.Net.Http.HttpClient.OmbiClient.ClientHandler[100]


      Sending HTTP request GET https://plex.tv/api/v2/pins/[DIGITS]


info: System.Net.Http.HttpClient.OmbiClient.ClientHandler[101]


      Received HTTP response headers after 573.2407ms - 200


info: System.Net.Http.HttpClient.OmbiClient.LogicalHandler[101]


      End processing HTTP request after 573.8414ms - 200
tidusjar

tidusjar commented on Jun 25, 2021

@tidusjar
Member

Can you open the dev tools? F12.

If so can you press the network tab and then refresh the page and attempt to log in.

You should see a call to /api/v1/token/YOURPIN, what is the response on that call?

pyarmak

pyarmak commented on Jun 25, 2021

@pyarmak

No problem, it posts some data (let me know if you want that as well) and the response is:

{
   "url":"https://app.plex.tv/auth#?code=REMOVED&context[device][product]=PashaFlix Requests&context[device][environment]=bundled&context[device][layout]=desktop&context[device][platform]=Web&context[device][device]=Ombi&clientID=REMOVED",
   "pinId":MYPIN
}
tidusjar

tidusjar commented on Jun 25, 2021

@tidusjar
Member

There should be another call once you close the window a GET

pyarmak

pyarmak commented on Jun 25, 2021

@pyarmak

My apologies, here is the response to the GET request:
{"errorMessage":"Could not authenticate with Plex"}
Not very descriptive, unfortunately.
EDIT: I should also mention that this also happens in incognito (no pre-existing cookies or any other nonsense).
@tidusjar I'd be happy to chat/help over google hangouts or what have you if you want to keep this issue from getting cluttered.

tidusjar

tidusjar commented on Jun 25, 2021

@tidusjar
Member

Would discord be fine?

Out of curiosity what timezone is your ombi server in? Also is the time correctly set?

pyarmak

pyarmak commented on Jun 25, 2021

@pyarmak

@tidusjar Discord works for me (Nooblazor#7778).
As for your question, I use linuxserver/ombi docker container and set ENV TZ America/Winnipeg (my timezone). I'm not sure where to check the timezone in Ombi's UI.
Using the date command in the container terminal yields:
Fri Jun 25 12:49:25 CDT 2021
While inspecting the PIN response in the devtools shows:
expiresAt: "2021-06-25T18:16:45Z"
So this leads me to believe that the date is set properly and shouldn't be rejected by:

if (pin.expiresAt < DateTime.UtcNow)

tidusjar

tidusjar commented on Jun 25, 2021

@tidusjar
Member

@pyarmak That was my theory, so nice investigation there.

Can you grab a new PIN Id and call GET https://plex.tv/api/v2/pins/PINID and does it contain the correct expiresAt and also the authToken property?

Because the only time we would get that message is if Ombi things the Pin has expired OR the authToken returned from the above API call is null/empty

shawnbarton

shawnbarton commented on Jun 26, 2021

@shawnbarton

I have also been experiencing this issue for a few days now with the latest docker container (which reports as
4.0.1430 in the UI). Different users are affected on a rotating basis. A container restart temporarily resolves the issue - at least for the single reporting user. The logs do not always show an error when it happens.

but I have some errors like this:

2021-06-25 04:19:26.841 +02:00 [Error] Something bad happened, ErrorMiddleware caught this
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
   at Microsoft.Data.Sqlite.SqliteTransaction.Commit()
   at System.Data.Common.DbTransaction.CommitAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.CommitAsync(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalTransaction.CommitAsync(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable`1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList`1 entriesToSave, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(DbContext _, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)
   at Ombi.Store.Repository.BaseRepository`2.InternalSaveChanges()
   at Ombi.Store.Repository.BaseRepository`2.Add(T content)
   at Ombi.Core.Engine.TvRequestEngine.AddRequest(TvRequests model, String requestOnBehalf)
   at Ombi.Core.Engine.TvRequestEngine.RequestTvShow(TvRequestViewModelV2 tv)
   at Ombi.Controllers.V2.RequestsController.RequestTv(TvRequestViewModelV2 tv)
   at lambda_method52196(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Ombi.ApiKeyMiddlewear.Invoke(HttpContext context)
   at Ombi.ErrorHandlingMiddleware.Invoke(HttpContext context)

And indeed when watching the developer tools during the login process, eventually, the
GET https://url/ombi/api/v1/token/xxxxx returns with
error: "SQLite Error 5: 'database is locked'.".

7 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @pyarmak@baemien@stevenpall@tidusjar@shawnbarton

        Issue actions

          cannot login into Ombi using Plex account · Issue #4232 · Ombi-app/Ombi