IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Support for ASP.Net core 2.0 api securing with IdentityServer3

Open selayamaran opened this issue 8 years ago • 2 comments

Hi I am new to this forum. I am having an issue. I have my auth server developed using Identityserver3 framework. i am using local signing cert and ssl enabled. The auth server is working fine and i get the response to https://localhost:44300/identity/.well-known/openid-configuration.

Recently, i started developing asp.net core 2.0 webapi and i had to use the existing auth server as mentioend above.

I tried the following in core api startup.cs.


        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication("Bearer")
                    .AddIdentityServerAuthentication(options =>
                    {
                        options.Authority= "https://localhost:44300";
                        options.ApiName = "web_api";
                    
					
            services.AddMvc();

		}
		
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // Enable CORS 
            app.UseCors(builder => builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader()
                .AllowCredentials());

            app.UseAuthentication();

            app.UseMvc();
        }

I used postman to get a token and use the token to access my api and getting error saying:

<h1>An unhandled exception occurred while processing the request.</h1>
           <div class="titleerror">JsonReaderException: Unexpected character encountered while parsing value: &lt;. Path &#x27;&#x27;, line 0, position 0.</div>
               <p class="location">Newtonsoft.Json.JsonTextReader.ParseValue()</p>
           <div class="titleerror">InvalidOperationException: IDX10803: Unable to obtain configuration from: &#x27;https://localhost:44300/.well-known/openid-configuration&#x27;.</div>
               <p class="location">Microsoft.IdentityModel.Protocols.ConfigurationManager&#x2B;&lt;GetConfigurationAsync&gt;d__24.MoveNext()</p>

As mentioned above, i am completely new to Identityserver.

Appreciate if anyone could help with this?

Thanks

selayamaran avatar Dec 20 '17 13:12 selayamaran

This seems to be a general question about IdentityServer - not a bug report or an issue.

Please use one of the our free or commercial support options

See here for more details.

Thanks!

brockallen avatar Dec 20 '17 14:12 brockallen

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 13 '20 22:01 lock[bot]