question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Client side introspection issue

See original GitHub issue

Hi Kevin I have Introspection set up on my identity server, and I have added the resource name into my ticket like so: ticket.Principal.SetResources("publicApi");

I can create a ticket in postman, and when I hit the introspection endpoint, I can see it working like so (this token has been revoked): image

However, when I use this token to access an endpoint in my client application, it is working as if the token is valid. When I look at my server logs I see that the introspection endpoint is being hit, but that it is querying the OpenIddictApplications table and returning an error saying: “The introspection request was rejected because the client application was not found: ‘{ClientId}’.”

It is not some sort of connection issue, because I can achieve the same result as in Postman if I call /introspect direct from inside my client application. I’m assuming that it is erroring through the client but not through Postman because the client is providing more data and in that case it checks the database - to make this work do I need to put data into the OpenIddictApplications table or can I solve this in the client configuration?

My client config looks like this (I’m not sure what the difference between an Audience and a ClientId is):

            services.AddOpenIddict()
                .AddValidation(options =>
                {

                    options.SetIssuer(_config["IdentityMicroServiceUrl"]);
                    options.AddAudiences("publicApi");

                    options.UseIntrospection()
                       .SetClientId("publicApi")
                       .SetClientSecret("846B62D0-DEF9-4215-A99D-86E6B8DAB342");

                    // Register the System.Net.Http integration.
                    options.UseSystemNetHttp();

                    // Register the ASP.NET Core host.
                    options.UseAspNetCore();
                });

Adding this into the server side code made no difference:

                    options.IgnoreEndpointPermissions()
                      .IgnoreGrantTypePermissions()
                      .IgnoreScopePermissions();

I’ve been plugging away at this for a while now, but each step is taking longer and longer, so I would be grateful if you can offer me some pointers to finally getting this working!

Thanks Duncan

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DuncancMartincommented, Mar 17, 2021

That fixed it, and now this whole process works. Thanks Kevin - it would have taken me forever to find that!

1reaction
kevinchaletcommented, Mar 17, 2021

Your ASP.NET Core configuration is invalid: you must register the authentication middleware before the authorization middleware.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why You Should Disable GraphQL Introspection In ...
Disabling introspection in production is a widely debated topic, but we believe it's one of the first things you can do to harden...
Read more >
GraphiQL introspection of client-side schema breaks with ...
Just ran into this issue defining typeDefs with apollo-link-state and including an extend Query declaration in that. Will keep that commented ...
Read more >
Introspection in GraphQL - Ignacio Chiazzo
Introspection is the ability to query which resources are available in the current API schema. Given the API, via introspection, we can see...
Read more >
Apollo GraphQL client query returns introspection result ...
I'm currently trying to get data from the Squidex API for a NextJS app, by using Apollo as GraphQL client. On localhost ,...
Read more >
Token Introspection Endpoint - OAuth 2.0 Simplified
If the introspection endpoint is left open and un-throttled, it presents a means for an attacker to poll the endpoint fishing for a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found