
FrankV.22174 (Customer) asked a question.
Hi,
I cannot find an example on how to implement JWT Tokens correctly into an dotnet core 2.1 webapi with a login (and logout) action that returns a JWT Token.
Login action would provide the JWT token if given the correct loging credentials : email and password
In my startup.cs i;m using:
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultSignInScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddOktaWebApi(new OktaWebApiOptions()
{
ClientId = "***************",//Configuration["Okta:ClientId"],
OktaDomain = "****************",//Configuration["Okta:OktaDomain"],
AuthorizationServerId = "****************" //Configuration["Okta:AuthorizationServerId"]
});
And I configured swagger ui to add a bearer token so that if i use the login action correctly i would retrieve a JWT token from some Okta service, and this is the point where I don't known what to use in the okta services stack? Which i then can use to authorize for actions that need authorization.
Hope this is clear enough, the examples i found don't include a sort of standalone webapi login action/functionality that uses Okta service(s).
The frontend will be an Angular 6 application that uses the login action and the returned JWT Token to authenticate for the private webapi calls.
Hope this makes sense ;)

Hi Frank,
Please have a look at the following documentation, as it may prove helpful :
If this is not enough for implementing you desired use case, i would recommend you would open a support case where we can further discuss this and assist you in your integration.
Thank you,
Alexandru Preda
Technical Support Engineer
Okta Global Customer Care
Hello Frank,
Thanks for posting your inquiry in Okta Community Portal.
If you receive a great answer to your question(s), please help readers find it by marking it the best answer. Hover over the answer and click "Best Answer."
Thank you,
Mike Davie
Okta Help Center