# How do I enter an authentication code into a oauth2 api request

**URL:** <https://www.patreondevelopers.com/t/how-do-i-enter-an-authentication-code-into-a-oauth2-api-request/5629>\
**Category:** Friendly Help\
**Created:** [June 19, 2022, 4:22am UTC](https://www.patreondevelopers.com/t/how-do-i-enter-an-authentication-code-into-a-oauth2-api-request/5629 "2022-06-19T04:22:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guess\_That\_NFT](https://avatars.discourse-cdn.com/v4/letter/g/ed8c4c/32.png) [@Guess\_That\_NFT](https://www.patreondevelopers.com/u/Guess_That_NFT)\
**Post date:** [June 19, 2022, 4:22am UTC](https://www.patreondevelopers.com/t/how-do-i-enter-an-authentication-code-into-a-oauth2-api-request/5629/1 "2022-06-19T04:22:54Z")

</div>

Hello, I have been stuck on this for days. I am trying to access [https://www.patreon.com/api/oauth2/v2/members/](https://www.patreon.com/api/oauth2/v2/members/) in python with requests. I know there is a module for the API in python but it has almost no features and I can’t use it for this. Basically, I need to know how to make the request. I’ve tried adding "?code=##### " to it, and I’ve tried adding a header to my request with the code. but I just can’t figure it out. All of these requests just return

{‘errors’: [{‘code’: 1, ‘code\_name’: ‘Unauthorized’, ‘detail’: “The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn’t understand how to supply the credentials required.”, ‘id’: ‘083bfdeb-5760-5af8-8aba-63902327e99c’, ‘status’: ‘401’, ‘title’: ‘Unauthorized’}]}

I know this is probably not an issue with the API. and just requests in general. But please any help is appreciated

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [June 20, 2022, 2:16pm UTC](https://www.patreondevelopers.com/t/how-do-i-enter-an-authentication-code-into-a-oauth2-api-request/5629/2 "2022-06-20T14:16:08Z")

</div>

Authorization code is used only once when you are calling the api to get the actual token after an authorization flow. Then you have to use the access token to make the call. Check how the PHP lib does that flow process (down below in the example):

> **[GitHub - Patreon/patreon-php: Interact with the Patreon API via OAuth](https://github.com/Patreon/patreon-php)**
>
> Interact with the Patreon API via OAuth. Contribute to Patreon/patreon-php development by creating an account on GitHub.
