# Oauth2 with pkce for Twitter API

**URL:** <https://community.postman.com/t/oauth2-with-pkce-for-twitter-api/49326>\
**Category:** Help Hub\
**Tags:** oauth2\
**Created:** [July 7, 2023, 1:17pm UTC](https://community.postman.com/t/oauth2-with-pkce-for-twitter-api/49326 "2023-07-07T13:17:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spaceflight-cosmon13](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@spaceflight-cosmon13](https://community.postman.com/u/spaceflight-cosmon13)\
**Post date:** [July 7, 2023, 1:17pm UTC](https://community.postman.com/t/oauth2-with-pkce-for-twitter-api/49326/1 "2023-07-07T13:17:02Z")

</div>

Ok… the error from the Postman console is:

“Error: Authentication window was closed”

What could it be? What am I missing?

I “think” I am using all the right information…

- postman callback website is good? I had something different, but I changed it… don’t know if it is correct?

- Auth URL + access token URL I think is good from twitter

- Client ID and Client Secret are good for sure.

- scope is there… do I need to put it “like this” ?

What else could I check or double check?

 ![postman1](https://us1.discourse-cdn.com/getpostman/original/3X/0/6/062e0322a3c6a89d04dd5e7bfc86d3b7f3ae1114.png)  
 ![postman2](https://us1.discourse-cdn.com/getpostman/original/3X/f/9/f9722f22eda211026a7d40a10111a587b08ef479.png)

---

<div class="post-metadata">

**Author:** ![spaceflight-cosmon13](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@spaceflight-cosmon13](https://community.postman.com/u/spaceflight-cosmon13)\
**Post date:** [July 7, 2023, 2:27pm UTC](https://community.postman.com/t/oauth2-with-pkce-for-twitter-api/49326/2 "2023-07-07T14:27:08Z")

</div>

I changed the callback URL to:

[https://oauth.pstmn.io/v1/browser-callback](https://oauth.pstmn.io/v1/browser-callback)

Now, error:

"Error: [object Object]

---

<div class="post-metadata">

**Author:** ![jmaylin](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jmaylin/32/27184_2.png) [@jmaylin](https://community.postman.com/u/jmaylin)\
**Post date:** [January 22, 2024, 4:41pm UTC](https://community.postman.com/t/oauth2-with-pkce-for-twitter-api/49326/3 "2024-01-22T16:41:01Z")

</div>

This post is pretty old, so hopefully you’ve fixed your problem by now. But just in case someone else is looking for an answer, here’s what sorted it out for me: I forgot to put **state** in the State field

---

<div class="post-metadata">

**Author:** ![security-meteorolog7](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/security-meteorolog7/32/32146_2.png) [@security-meteorolog7](https://community.postman.com/u/security-meteorolog7)\
**Post date:** [April 6, 2025, 10:13am UTC](https://community.postman.com/t/oauth2-with-pkce-for-twitter-api/49326/4 "2025-04-06T10:13:23Z")

</div>

you saved my life… spent 2 hours with claude and no luck, then your post save me. Thank you!
