Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

preflight request doesn't pass access control #39

Open
DTHerrera opened this issue May 14, 2018 · 0 comments
Open

preflight request doesn't pass access control #39

DTHerrera opened this issue May 14, 2018 · 0 comments

Comments

@DTHerrera
Copy link

Hi, after register a nemiro.oAuth API in my project, when a try to signing user with FaceBook or Twitter i get the followin mesagges:

api.twitter.com/oauth/authorize?oauth_token=DdapZwAAAAAA4_VyAAABY19RKB0:1 Failed to load resource: the server responded with a status of 400 ()
Home:1 Failed to load https://api.twitter.com/oauth/authorize?oauth_token=DdapZwAAAAAA4_VyAAABY19RKB0: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:44305' is therefore not allowed access. The response had HTTP status code 400.

Home:1 Failed to load https://www.linkedin.com/uas/oauth2/authorization?client_id=8649u8izdndqu5&response_type=code&state=fc48a1908548404caffb0338018ffd7f&scope=r_basicprofile%20r_emailaddress&redirect_uri=https%3A%2F%2Flocalhost%3A44305%2FHome%2FExternalLoginResult: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:44305' is therefore not allowed access.

Home:1 Failed to load https://www.facebook.com/dialog/oauth?client_id=225631291319901&response_type=code&state=a93f3e7389a241489483bd8f4ca5b8ec&scope=public_profile%2Cemail&redirect_uri=https%3A%2F%2Flocalhost%3A44305%2FHome%2FExternalLoginResult: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:44305' is therefore not allowed access.

in mi project i used the nemiro.OAuth like this:

[Route("LoginExterno/{provider}")]
[HttpPost]
[AllowAnonymous]
//[HttpGet]

    public async Task<IHttpActionResult> LoginExterno(string provider = "")
    {
        if (string.IsNullOrWhiteSpace(provider))
        {
            ModelState.AddModelError("", "Se requiere el provedor de autenticación");
            return BadRequest(ModelState);
        }

        //var returnUrl = new Uri("/Home/ExternalLoginResult", UriKind.Relative).AbsoluteUri;  //
        //return Redirect(Url.Content("~/") + "#error=" + Uri.EscapeDataString("/Home/ExternalLoginResult"));
        string returnUrl =  Url.Content("~/") + "Home/ExternalLoginResult";
         OAuthWeb.RedirectToAuthorization(provider, returnUrl);

        return Ok();
    }

could you help me please?, what I do wrong in the implementation.

thenak in advance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant