How to obtain the OAuth authorization code directly from the URL in .NET without using a browser or plugin?

31 Views Asked by At

Is there a way to obtain the 'code' variable directly via the backend, without the need to redirect the user to the login page through a browser or passing the code and codeVerifier variables from a plugin?

I'm looking for a solution that would allow for a smoother integration with our system, especially in scenarios where we'd like to minimize or eliminate steps requiring user interaction. I wonder if it's possible to implement this process programmatically at the backend level.

I've tried hitting that endpoint from the backend, but I receive a response in HTML. I would need to know if there's a possibility to obtain the 'Code' variable on the backend. If so, how? If not, I'll pass that variable from the plugin.

1

There are 1 best solutions below

0
Jaime Lopez Jr. On

The short answer is that there isn't a way to do what you're trying to achieve.

The OAuth 2.0 Authorization Code flow is intended to be used by a user in a client app. There is of course participation from a backend, but it's not meant to be a backend-to-backend authorization.

Our Authentication (Command Line) quickstart should be helpful in illustrating how this works.