fix(oauth): 🔒 Fixed the issue where some users running their browsers in a different language could not open the Plex OAuth window

#4408
pull/4445/head
tidusjar 3 years ago
parent 209e31175c
commit d5404eaad7

@ -177,6 +177,7 @@ export class LoginComponent implements OnDestroy, OnInit {
if (this.oAuthWindow) { if (this.oAuthWindow) {
this.oAuthWindow.close(); this.oAuthWindow.close();
} }
this.oAuthWindow = window.open( this.oAuthWindow = window.open(
window.location.toString(), window.location.toString(),
"_blank", "_blank",
@ -214,6 +215,11 @@ export class LoginComponent implements OnDestroy, OnInit {
} }
public getPinResult(pinId: number) { public getPinResult(pinId: number) {
if (this.oAuthWindow.closed) {
if (this.pinTimer) {
clearInterval(this.pinTimer);
}
}
this.authService.oAuth(pinId).subscribe( this.authService.oAuth(pinId).subscribe(
(x) => { (x) => {
if (x.access_token) { if (x.access_token) {

@ -1,10 +1,8 @@
import { PlatformLocation, APP_BASE_HREF } from "@angular/common"; import { HttpClient, HttpHeaders } from "@angular/common/http";
import { HttpClient, HttpHeaders } from "@angular/common/http";
import { Injectable, Inject } from "@angular/core";
import { Observable } from "rxjs";
import { IPlexPin } from "../../interfaces"; import { IPlexPin } from "../../interfaces";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
@Injectable() @Injectable()
export class PlexTvService { export class PlexTvService {
@ -13,7 +11,7 @@ export class PlexTvService {
} }
public GetPin(clientId: string, applicationName: string): Observable<IPlexPin> { public GetPin(clientId: string, applicationName: string): Observable<IPlexPin> {
const headers = new HttpHeaders({"Content-Type": "application/json", const headers = new HttpHeaders({"Content-Type": "application/json; charset=ISO-8859-1",
"X-Plex-Client-Identifier": clientId, "X-Plex-Client-Identifier": clientId,
"X-Plex-Product": applicationName, "X-Plex-Product": applicationName,
"X-Plex-Version": "3", "X-Plex-Version": "3",

Loading…
Cancel
Save