# How to protect an api using okta?

**URL:** <https://devforum.okta.com/t/how-to-protect-an-api-using-okta/4962>\
**Category:** Questions\
**Created:** [April 26, 2019, 9:06pm UTC](https://devforum.okta.com/t/how-to-protect-an-api-using-okta/4962 "2019-04-26T21:06:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtrevino](https://avatars.discourse-cdn.com/v4/letter/d/439d5e/32.png) [@dtrevino](https://devforum.okta.com/u/dtrevino)\
**Post date:** [April 26, 2019, 9:06pm UTC](https://devforum.okta.com/t/how-to-protect-an-api-using-okta/4962/1 "2019-04-26T21:06:04Z")

</div>

Hi I am using flask and okta in order to create a secure api, is secure my code? first of all, I start the session from my web applkication and after that with the next code from my api I validate session: @inmueble.route("/", methods = [‘GET’])  
@oidc.require\_login  
def get\_inmuebles():  
inmuebles= Inmueble.query.all()  
result = inmuebles\_schema.dump(inmuebles)

```
    return jsonify(result.data)
```

---

<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:** [January 17, 2024, 11:26pm UTC](https://devforum.okta.com/t/how-to-protect-an-api-using-okta/4962/2 "2024-01-17T23:26:33Z")

</div>

Closed on January 17, 2024, 11:26pm UTC


