Last post Aug 02, 2017 07:56 AM by Jean Sun
Jul 29, 2017 05:29 PM|wouyoshi|LINK
I'm trying to host my own OAuth 2.0 Authorization Server.
I've found this tutorial with code that looks like a good example:
The code is running very well in IIS Express, however I want to run this code in IIS.
So I did the following:
public const string AuthorizationServerBaseAddress = "http://localhost";
public const string AuthorizePath = "/AuthorizationServer/OAuth/Authorize";
public const string TokenPath = "/AuthorizationServer/OAuth/Token";
Then I run the AuthorizationCodeGrant and do the following:
What am I doing wrong? In IIS Express the Grant button redirects me just fine.
Aug 02, 2017 07:55 AM|Brando ZWZ|LINK
As far as I know,If the Grant button is selected, the Authorize action will create a new "Bearer" identity and sign in with it. It will trigger the authorization server to generate a bearer token and send it back to the client with JSON payload.
I have also published the AuthorizationServer to the IIS and run the AuthorizationCodeGrant project in the VS to test it. It works well, it will auto redirect to the AuthorizationCodeGrant auth page.
The test image like this:
The path setting is like below:
public static class Paths
/// AuthorizationServer project should run on this URL
public const string AuthorizationServerBaseAddress = "http://localhost:9756/";
/// ResourceServer project should run on this URL
public const string ResourceServerBaseAddress = "http://localhost:38385";
/// ImplicitGrant project should be running on this specific port '38515'
public const string ImplicitGrantCallBackPath = "http://localhost:38515/Home/SignIn";
/// AuthorizationCodeGrant project should be running on this URL.
public const string AuthorizeCodeCallBackPath = "http://localhost:38500/";
public const string AuthorizePath = "/OAuth/Authorize";
public const string TokenPath = "/OAuth/Token";
public const string LoginPath = "/Account/Login";
public const string LogoutPath = "/Account/Logout";
public const string MePath = "/api/Me";
I suggest you could just change the base path with http://localhost/AuthorizationServer and test it again.
If the grant button still doesn't work, I suggest you could post more details about how you change the AuthorizationServer projects for us to repro your issue.
Aug 02, 2017 07:56 AM|Jean Sun|LINK
I downloaded the project, modify the code to the same as yours and set the AuthorizationServer project to run on local IIS. It works fine on my side. When I click the Grant button it gets redirected.
How it works on my side.
Please check the F12 network tab to see if there is any error with these requests.
When the Grant button is clicked it will call the AuthorizationServer OAuthController -> Authorize action, you can debug this action to check if there is any error when running the code.