mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Revert "Fixed Plex OAuth, should no longer show Insecure warning"
This reverts commit c55fc32c63
.
This commit is contained in:
parent
c55fc32c63
commit
cbf331cd09
4 changed files with 24 additions and 29 deletions
|
@ -214,7 +214,7 @@ namespace Ombi.Api.Plex
|
||||||
? new Request($"Wizard/OAuth/{pinId}", applicationUrl, HttpMethod.Get)
|
? new Request($"Wizard/OAuth/{pinId}", applicationUrl, HttpMethod.Get)
|
||||||
: new Request($"Login/OAuth/{pinId}", applicationUrl, HttpMethod.Get);
|
: new Request($"Login/OAuth/{pinId}", applicationUrl, HttpMethod.Get);
|
||||||
|
|
||||||
//request.AddQueryString("forwardUrl", forwardUrl.FullUri.ToString());
|
request.AddQueryString("forwardUrl", forwardUrl.FullUri.ToString());
|
||||||
request.AddQueryString("pinID", pinId.ToString());
|
request.AddQueryString("pinID", pinId.ToString());
|
||||||
request.AddQueryString("code", code);
|
request.AddQueryString("code", code);
|
||||||
request.AddQueryString("context[device][product]", "Ombi");
|
request.AddQueryString("context[device][product]", "Ombi");
|
||||||
|
|
|
@ -34,6 +34,19 @@ namespace Ombi.Core.Authentication
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pin.authToken.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
// Looks like we do not have a pin yet, we should retry a few times.
|
||||||
|
var retryCount = 0;
|
||||||
|
var retryMax = 5;
|
||||||
|
var retryWaitMs = 1000;
|
||||||
|
while (pin.authToken.IsNullOrEmpty() && retryCount < retryMax)
|
||||||
|
{
|
||||||
|
retryCount++;
|
||||||
|
await Task.Delay(retryWaitMs);
|
||||||
|
pin = await _api.GetPin(pinId);
|
||||||
|
}
|
||||||
|
}
|
||||||
return pin.authToken;
|
return pin.authToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ export class LoginComponent implements OnDestroy, OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
private timer: any;
|
private timer: any;
|
||||||
private pinTimer: any;
|
|
||||||
|
|
||||||
private errorBody: string;
|
private errorBody: string;
|
||||||
private errorValidation: string;
|
private errorValidation: string;
|
||||||
|
@ -125,35 +124,18 @@ export class LoginComponent implements OnDestroy, OnInit {
|
||||||
|
|
||||||
public oauth() {
|
public oauth() {
|
||||||
this.authService.login({usePlexOAuth: true, password:"",rememberMe:true,username:""}).subscribe(x => {
|
this.authService.login({usePlexOAuth: true, password:"",rememberMe:true,username:""}).subscribe(x => {
|
||||||
|
if (window.frameElement) {
|
||||||
|
// in frame
|
||||||
window.open(x.url, "_blank");
|
window.open(x.url, "_blank");
|
||||||
this.pinTimer = setInterval(() => {
|
} else {
|
||||||
this.getPinResult(x.pinId);
|
// not in frame
|
||||||
}, 10000);
|
window.location.href = x.url;
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public getPinResult(pinId: number) {
|
|
||||||
this.authService.oAuth(pinId).subscribe(x => {
|
|
||||||
if(x.access_token) {
|
|
||||||
localStorage.setItem("id_token", x.access_token);
|
|
||||||
|
|
||||||
if (this.authService.loggedIn()) {
|
|
||||||
this.router.navigate(["search"]);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
}, err => {
|
|
||||||
this.notify.error(err.statusText);
|
|
||||||
|
|
||||||
this.router.navigate(["login"]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ngOnDestroy() {
|
public ngOnDestroy() {
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer);
|
||||||
clearInterval(this.pinTimer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private cycleBackground() {
|
private cycleBackground() {
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace Ombi.Controllers
|
||||||
error = "Application URL has not been set"
|
error = "Application URL has not been set"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return new JsonResult(new { url = url.ToString(), pinId = pin.id });
|
return new JsonResult(new { url = url.ToString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UnauthorizedResult();
|
return new UnauthorizedResult();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue