# Okta flask Python App works locally but not when I host it in Azure

**URL:** <https://devforum.okta.com/t/okta-flask-python-app-works-locally-but-not-when-i-host-it-in-azure/10950>\
**Category:** Questions\
**Created:** [September 14, 2020, 10:29pm UTC](https://devforum.okta.com/t/okta-flask-python-app-works-locally-but-not-when-i-host-it-in-azure/10950 "2020-09-14T22:29:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdaniel7](https://avatars.discourse-cdn.com/v4/letter/c/439d5e/32.png) [@cdaniel7](https://devforum.okta.com/u/cdaniel7)\
**Post date:** [September 14, 2020, 10:29pm UTC](https://devforum.okta.com/t/okta-flask-python-app-works-locally-but-not-when-i-host-it-in-azure/10950/1 "2020-09-14T22:29:36Z")

</div>

Hi Folks,  
I cloned Okta’s [GitHub flask python code](https://github.com/okta/samples-python-flask/tree/master/okta-hosted-login) and it worked fine locally. But when I host it on Azure webapp I get 400 error.

 ![Screen Shot 2020-09-14 at 3.23.50 PM](https://global.discourse-cdn.com/oktadev/original/2X/6/63b4a3002995613d44e69c7d733ceca3bb87bed2.png)

Here is my code → [https://github.com/cdevairakkam7/pre\_production](https://github.com/cdevairakkam7/pre_production)

following is the error link I get.

[https://dev-920484.okta.com/oauth2/default/v1/authorize?client\_id=0oay1g2d1xlA3KWm84x6&redirect\_uri=http%3A%2F%2Fuatomeletxyz.azurewebsites.net%2Foidc\_callback&scope=openid+profile+email&access\_type=offline&response\_type=code&state={"csrf\_token"%3A+"3iIABJj2Fur%2BzhNsERpQs1uHj%2BXTR8ZQ"%2C+"destination"%3A+"eyJhbGciOiJIUzUxMiJ9.Imh0dHA6Ly91YXRvbWVsZXR4eXouYXp1cmV3ZWJzaXRlcy5uZXQvbG9naW4i.2\_u9qAWrI\_h29D-FLWDu-kuh\_DfNDg5e2icS2bv1evIYrnKhnCiFHGoPnYhah8VirUE4L50N8yFVHgv3k7Kwqw"}](https://dev-920484.okta.com/oauth2/default/v1/authorize?client_id=0oay1g2d1xlA3KWm84x6&redirect_uri=http%3A%2F%2Fuatomeletxyz.azurewebsites.net%2Foidc_callback&scope=openid+profile+email&access_type=offline&response_type=code&state=%7B%22csrf_token%22%3A+%223iIABJj2Fur%2BzhNsERpQs1uHj%2BXTR8ZQ%22%2C+%22destination%22%3A+%22eyJhbGciOiJIUzUxMiJ9.Imh0dHA6Ly91YXRvbWVsZXR4eXouYXp1cmV3ZWJzaXRlcy5uZXQvbG9naW4i.2_u9qAWrI_h29D-FLWDu-kuh_DfNDg5e2icS2bv1evIYrnKhnCiFHGoPnYhah8VirUE4L50N8yFVHgv3k7Kwqw%22%7D)

Here is my okta settings

 ![Screen Shot 2020-09-14 at 3.27.12 PM](https://global.discourse-cdn.com/oktadev/original/2X/7/7d51ba4d7be6d79278ea207e79b19faca0a2f9d5.png)

I have also added my website to trusted origin.

Please tell me what else I should do to make this work.

Thanks,  
Chris

---

<div class="post-metadata">

**Author:** ![vijet](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/vijet/32/245_2.png) [@vijet](https://devforum.okta.com/u/vijet)\
**Post date:** [September 14, 2020, 10:54pm UTC](https://devforum.okta.com/t/okta-flask-python-app-works-locally-but-not-when-i-host-it-in-azure/10950/2 "2020-09-14T22:54:32Z")

</div>

Hi @cdaniel7,

Looking at the error message, it seems like your redirect\_uri is [https://uatomeletxyz.azurewebsites.net/oidc\_callback](https://uatomeletxyz.azurewebsites.net/oidc_callback)

But in your app settings, you’ve added [https://uatomeletxyz.azurewebsites.net/authorization-code/callback](https://uatomeletxyz.azurewebsites.net/authorization-code/callback)  
Can you add a new redirect\_uri with the value [https://uatomeletxyz.azurewebsites.net/oidc\_callback](https://uatomeletxyz.azurewebsites.net/oidc_callback) and try if that works?

---

<div class="post-metadata">

**Author:** ![cdaniel7](https://avatars.discourse-cdn.com/v4/letter/c/439d5e/32.png) [@cdaniel7](https://devforum.okta.com/u/cdaniel7)\
**Post date:** [September 15, 2020, 1:46am UTC](https://devforum.okta.com/t/okta-flask-python-app-works-locally-but-not-when-i-host-it-in-azure/10950/3 "2020-09-15T01:46:24Z")

</div>

Hi @vijet, Works. Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 25, 2024, 12:26am UTC](https://devforum.okta.com/t/okta-flask-python-app-works-locally-but-not-when-i-host-it-in-azure/10950/4 "2024-01-25T00:26:19Z")

</div>

Closed on January 25, 2024, 12:26am UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
