Skip to content

Login is returning an invalid token #7

@tanis2000

Description

@tanis2000

I noticed that at this line https://github.com/SoftUni/SPA-with-AngularJS/blob/master/Ads-REST-Services/Ads.Web/Controllers/UserController.cs#L122 you're using the TestServer class to issue the new token. I noticed that the token isn't working if you then pass it to any authorized method.

Instead I replaced that code with:

            HttpClient hc = new HttpClient();
            var request = HttpContext.Current.Request;
            var tokenServiceResponse = await hc.PostAsync(string.Format("{0}://{1}", request.Url.Scheme, request.Url.Authority) + Startup.OAuthOptions.TokenEndpointPath.ToString(), requestParamsFormUrlEncoded);

This way it's actually calling our real /Token route and retrieving a valid token.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions