Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Commit 559fdc4

Browse files
committed
WebAPI: Move frontend uri to appsettings
1 parent 18183bd commit 559fdc4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ASPNET_WebAPI/Controllers/AuthController.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ namespace GoogleOIDC_Angular_ASPNETWebAPI_Auth_Code_Flow.Controllers;
99
public class AuthController : ControllerBase
1010
{
1111
private readonly OIDCService _oidcService;
12+
private readonly IConfiguration _config;
1213

1314
public AuthController(
14-
OIDCService oidcService)
15+
OIDCService oidcService,
16+
IConfiguration config)
1517
{
1618
_oidcService = oidcService;
19+
_config = config;
1720
}
1821

1922
[HttpGet("oidc/signin", Name = nameof(SigninOIDCAsync))]
@@ -33,7 +36,7 @@ public async Task<IActionResult> SigninOIDCAsync(string code, string state, stri
3336
_oidcService.SetupRedirectUri(Request, "api/Auth/oidc/signin");
3437
string idToken = await _oidcService.GetIdTokenAsync(code);
3538

36-
return Redirect("http://localhost:4200?idToken=" + idToken);
39+
return Redirect($"{_config["FrontEndUri"]}?idToken={idToken}");
3740
}
3841

3942
}

ASPNET_WebAPI/appsettings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
"ClientId": "YOUR CLIENT ID",
1212
"ClientSecret": "YOUR CLIENT SECRET"
1313
}
14-
}
14+
},
15+
"FrontEndUri": "http://localhost:4200"
1516
}

0 commit comments

Comments
 (0)