mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -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<PlexAccount> GetAccount(string authToken);
|
||||||
Task<PlexMetadata> GetRecentlyAdded(string authToken, string uri, string sectionId);
|
Task<PlexMetadata> GetRecentlyAdded(string authToken, string uri, string sectionId);
|
||||||
Task<OAuthPin> GetPin(int pinId);
|
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);
|
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);
|
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);
|
var request = new Request("auth#", "https://app.plex.tv", HttpMethod.Get);
|
||||||
await AddHeaders(request);
|
await AddHeaders(request);
|
||||||
|
|
||||||
request.AddQueryString("pinID", pinId.ToString());
|
|
||||||
request.AddQueryString("code", code);
|
request.AddQueryString("code", code);
|
||||||
request.AddQueryString("context[device][product]", ApplicationName);
|
request.AddQueryString("context[device][product]", ApplicationName);
|
||||||
request.AddQueryString("context[device][environment]", "bundled");
|
request.AddQueryString("context[device][environment]", "bundled");
|
||||||
|
|
|
@ -36,17 +36,17 @@ namespace Ombi.Core.Authentication
|
||||||
return await _api.GetAccount(accessToken);
|
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 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;
|
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;
|
return url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ namespace Ombi.Core.Authentication
|
||||||
public interface IPlexOAuthManager
|
public interface IPlexOAuthManager
|
||||||
{
|
{
|
||||||
Task<string> GetAccessTokenFromPin(int pinId);
|
Task<string> GetAccessTokenFromPin(int pinId);
|
||||||
Task<Uri> GetOAuthUrl(int pinId, string code, string websiteAddress = null);
|
Task<Uri> GetOAuthUrl(string code, string websiteAddress = null);
|
||||||
Task<Uri> GetWizardOAuthUrl(int pinId, string code, string websiteAddress);
|
Task<Uri> GetWizardOAuthUrl(string code, string websiteAddress);
|
||||||
Task<PlexAccount> GetAccount(string accessToken);
|
Task<PlexAccount> GetAccount(string accessToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -283,12 +283,12 @@ namespace Ombi.Controllers.External
|
||||||
Uri url;
|
Uri url;
|
||||||
if (!wizard.Wizard)
|
if (!wizard.Wizard)
|
||||||
{
|
{
|
||||||
url = await _plexOAuthManager.GetOAuthUrl(wizard.Pin.id, wizard.Pin.code);
|
url = await _plexOAuthManager.GetOAuthUrl(wizard.Pin.code);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var websiteAddress =$"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}";
|
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)
|
if (url == null)
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace Ombi.Controllers
|
||||||
|
|
||||||
var websiteAddress = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}";
|
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
|
//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)
|
if (url == null)
|
||||||
{
|
{
|
||||||
return new JsonResult(new
|
return new JsonResult(new
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue