Okta web api 2.0, angular, development okta domain


#1

I have an angular app that is authenticating with okta, and then passing a bearer token to a Web API 2.0 C# service. I am consistently getting a 401 when I try to authorize requests.

The angular app returns an authtoken succesfully

this.oktaAuth.getAccessToken().then(accessToken => {

}

which is being passed in the header (which I have verified)

const headers = new HttpHeaders(
{ Authorization: ‘Bearer "’ + this.accessToken + ‘"’ }

to a Web API 2.0 server, which is configuration in the Startup.cs file to authorize the requests:

public void Configuration(IAppBuilder app)
{
string oktaDomain = ConfigurationManager.AppSettings[“okta:OktaDomain”];
string clientId = ConfigurationManager.AppSettings[“okta:ClientId”];
app.UseOktaWebApi(new OktaWebApiOptions()
{
OktaDomain = oktaDomain,
ClientId = clientId
});
}

the OktaDomain I have set to both the domain e.g. https://dev-xxxxx.oktapreview.com, and the domain plus the application server end point e.g. https://dev-xxxxx.oktapreview/oauth2/default

I originally passed the token without the double quotes, but the API would just hang.

any ideas?


#2

Hi @ncaramello ,

I have run into same issue too. Were you able to find a solution to this problem?

I have tried using JWT as well as OktaWebApiOptions and got 401

Thanks


#3

Hi @nate.barbettini ,

Would you know if this is an early access feature?

Thanks

Kartik


#4

Hi @ncaramello @Kartikganesan

Please open a support ticket with us by sending an email to developers@okta.com in order to further investigate.