Beispiel #1
0
        public async Task <IActionResult> OAuth([FromBody] PlexOAuthViewModel wizard)
        {
            //https://app.plex.tv/auth#?forwardUrl=http://google.com/&clientID=Ombi-Test&context%5Bdevice%5D%5Bproduct%5D=Ombi%20SSO&pinID=798798&code=4lgfd
            // Plex OAuth
            // Redirect them to Plex

            Uri url;

            if (!wizard.Wizard)
            {
                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.code, websiteAddress);
            }

            if (url == null)
            {
                return(new JsonResult(new
                {
                    error = "Application URL has not been set"
                }));
            }

            return(new JsonResult(new { url = url.ToString() }));
        }