mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-13 01:56:55 -07:00
Removed the pinID from the OAuth url #2548
This commit is contained in:
parent
d19efd91a5
commit
bb4d59e355
6 changed files with 11 additions and 12 deletions
|
@ -24,7 +24,7 @@ namespace Ombi.Api.Plex
|
|||
Task<PlexAccount> GetAccount(string authToken);
|
||||
Task<PlexMetadata> GetRecentlyAdded(string authToken, string uri, string sectionId);
|
||||
Task<OAuthPin> GetPin(int pinId);
|
||||
Task<Uri> GetOAuthUrl(int pinId, string code, string applicationUrl);
|
||||
Task<Uri> GetOAuthUrl(string code, string applicationUrl);
|
||||
Task<PlexAddWrapper> AddUser(string emailAddress, string serverId, string authToken, int[] libs);
|
||||
}
|
||||
}
|
|
@ -217,12 +217,11 @@ namespace Ombi.Api.Plex
|
|||
return await Api.Request<OAuthPin>(request);
|
||||
}
|
||||
|
||||
public async Task<Uri> GetOAuthUrl(int pinId, string code, string applicationUrl)
|
||||
public async Task<Uri> GetOAuthUrl(string code, string applicationUrl)
|
||||
{
|
||||
var request = new Request("auth#", "https://app.plex.tv", HttpMethod.Get);
|
||||
await AddHeaders(request);
|
||||
|
||||
request.AddQueryString("pinID", pinId.ToString());
|
||||
request.AddQueryString("code", code);
|
||||
request.AddQueryString("context[device][product]", ApplicationName);
|
||||
request.AddQueryString("context[device][environment]", "bundled");
|
||||
|
|
|
@ -36,17 +36,17 @@ namespace Ombi.Core.Authentication
|
|||
return await _api.GetAccount(accessToken);
|
||||
}
|
||||
|
||||
public async Task<Uri> GetOAuthUrl(int pinId, string code, string websiteAddress = null)
|
||||
public async Task<Uri> GetOAuthUrl(string code, string websiteAddress = null)
|
||||
{
|
||||
var settings = await _customizationSettingsService.GetSettingsAsync();
|
||||
var url = await _api.GetOAuthUrl(pinId, code, settings.ApplicationUrl.IsNullOrEmpty() ? websiteAddress : settings.ApplicationUrl);
|
||||
var url = await _api.GetOAuthUrl(code, settings.ApplicationUrl.IsNullOrEmpty() ? websiteAddress : settings.ApplicationUrl);
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
public async Task<Uri> GetWizardOAuthUrl(int pinId, string code, string websiteAddress)
|
||||
public async Task<Uri> GetWizardOAuthUrl(string code, string websiteAddress)
|
||||
{
|
||||
var url = await _api.GetOAuthUrl(pinId, code, websiteAddress);
|
||||
var url = await _api.GetOAuthUrl(code, websiteAddress);
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Ombi.Core.Authentication
|
|||
public interface IPlexOAuthManager
|
||||
{
|
||||
Task<string> GetAccessTokenFromPin(int pinId);
|
||||
Task<Uri> GetOAuthUrl(int pinId, string code, string websiteAddress = null);
|
||||
Task<Uri> GetWizardOAuthUrl(int pinId, string code, string websiteAddress);
|
||||
Task<Uri> GetOAuthUrl(string code, string websiteAddress = null);
|
||||
Task<Uri> GetWizardOAuthUrl(string code, string websiteAddress);
|
||||
Task<PlexAccount> GetAccount(string accessToken);
|
||||
}
|
||||
}
|
|
@ -283,12 +283,12 @@ namespace Ombi.Controllers.External
|
|||
Uri url;
|
||||
if (!wizard.Wizard)
|
||||
{
|
||||
url = await _plexOAuthManager.GetOAuthUrl(wizard.Pin.id, wizard.Pin.code);
|
||||
url = await _plexOAuthManager.GetOAuthUrl(wizard.Pin.code);
|
||||
}
|
||||
else
|
||||
{
|
||||
var websiteAddress =$"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}";
|
||||
url = await _plexOAuthManager.GetWizardOAuthUrl(wizard.Pin.id, wizard.Pin.code, websiteAddress);
|
||||
url = await _plexOAuthManager.GetWizardOAuthUrl(wizard.Pin.code, websiteAddress);
|
||||
}
|
||||
|
||||
if (url == null)
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace Ombi.Controllers
|
|||
|
||||
var websiteAddress = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}";
|
||||
//https://app.plex.tv/auth#?forwardUrl=http://google.com/&clientID=Ombi-Test&context%5Bdevice%5D%5Bproduct%5D=Ombi%20SSO&pinID=798798&code=4lgfd
|
||||
var url = await _plexOAuthManager.GetOAuthUrl(model.PlexTvPin.id, model.PlexTvPin.code, websiteAddress);
|
||||
var url = await _plexOAuthManager.GetOAuthUrl(model.PlexTvPin.code, websiteAddress);
|
||||
if (url == null)
|
||||
{
|
||||
return new JsonResult(new
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue