# Authorization-code/callback throw exception after login

**URL:** <https://devforum.okta.com/t/authorization-code-callback-throw-exception-after-login/21929>\
**Category:** OAuth/OIDC\
**Created:** [September 20, 2022, 10:52am UTC](https://devforum.okta.com/t/authorization-code-callback-throw-exception-after-login/21929 "2022-09-20T10:52:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RijShah](https://avatars.discourse-cdn.com/v4/letter/r/b3f665/32.png) [@RijShah](https://devforum.okta.com/u/RijShah)\
**Post date:** [September 20, 2022, 10:52am UTC](https://devforum.okta.com/t/authorization-code-callback-throw-exception-after-login/21929/1 "2022-09-20T10:52:00Z")

</div>

Hi,

I have created app of OIDC with web App with 2F and its implemented in local machine and working fine in local but when its deploy on server then page is stuck ‘authorization-code/callback’.  
I implemented both code one by one as below

1. public void Configuration(IAppBuilder app)  
{  
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

For Reference : [https://github.com/okta/samples-aspnet-webforms/tree/master/okta-hosted-login/okta-aspnet-webforms-example](https://github.com/okta/samples-aspnet-webforms/tree/master/okta-hosted-login/okta-aspnet-webforms-example)

1. public void ConfigureAuth(IAppBuilder app)  
{

app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

app.UseCookieAuthentication(new CookieAuthenticationOptions());

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions

{

```
ClientId = _clientId,

ClientSecret = _clientSecret,

Authority = _authority,

RedirectUri = _redirectUri,

ResponseType = OpenIdConnectResponseType.CodeIdToken,

Scope = OpenIdConnectScope.OpenIdProfile,

TokenValidationParameters = new TokenValidationParameters { NameClaimType = "name" },

Notifications = new OpenIdConnectAuthenticationNotifications

{

  AuthorizationCodeReceived = async n =>

  {

   .......
   .........
   ........

```

> [@.NET webforms with Okta as an Authorization Server](https://devforum.okta.com/t/net-webforms-with-okta-as-an-authorization-server/16704):
>
> we are using .NET webforms to authenticate Okta user and log him in to our app. the code works fine with Custom Authorization Server. Our client uses Okta as an Authorization Server and I cannot make it work with it. Any help will be appreciated. here is my code in Startup.cs: public void ConfigureAuth(IAppBuilder app) { app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie); app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); ap…

> <https://github.com/oktadev/okta-aspnet-webforms-example/tree/master/SimpleOktaWebformsExample>
>
> //github.com/oktadev/okta-aspnet-webforms-example/tree/master/SimpleOktaWebformsExample

Still issue is not resolved on server. Is any changes required on server(IIS)?

---

<div class="post-metadata">

**Author:** ![erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@erik](https://devforum.okta.com/u/erik)\
**Post date:** [September 23, 2022, 12:17am UTC](https://devforum.okta.com/t/authorization-code-callback-throw-exception-after-login/21929/2 "2022-09-23T00:17:26Z")

</div>

Hello,  
When you test on a deployed server are you using `http` or `https`?  
Anything other than localhost (127.0.0.1) will require `https`.

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 13, 2024, 12:57am UTC](https://devforum.okta.com/t/authorization-code-callback-throw-exception-after-login/21929/3 "2024-02-13T00:57:54Z")

</div>

Closed on February 13, 2024, 12:57am UTC


