# Login credentials in Oauth2 popup window

**URL:** <https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846>\
**Category:** Help Hub\
**Tags:** oauth2\
**Created:** [February 10, 2023, 6:51pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846 "2023-02-10T18:51:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dougleenhoutsvivint](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@dougleenhoutsvivint](https://community.postman.com/u/dougleenhoutsvivint)\
**Post date:** [February 10, 2023, 6:51pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/1 "2023-02-10T18:51:05Z")

</div>

**Your question may already have an answer on the community forum. Please search for related topics, and then read through the [guidelines](https://community.postman.com/t/about-the-just-getting-started-category/37) before creating a new topic.**

> Here’s an outline with best practices for making your inquiry.

_My question_: How do you use username & password variables in the oauth2 login window?

_Details (like screenshots)_: I’ve got usernames & passwords of test accounts saved as variables, but I’d like to use them in our oauth2 flow to get authorization tokens. The login popup that appears when I hit the “Get New Access Token” button seems like it can only accept hand-typed credentials. How do you use the oauth2 auth flow when you’re running an entire folder or collection that depends on that token? Does it have to be a manual process every time?

_How I found the problem_: Our plain old cookie-based authorization is just a POST to a /login endpoint with a {{username}} and {{password}} body, so when this request is run at the beginning of a collection run, it sets the cookie, then the rest of the requests in the collection run with that session cookie. There doesn’t seem to be an equivalent way to “pass a stored username & password” into the oauth2 window.

_I’ve already tried_: Googling & stack-exchanging.

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [February 10, 2023, 8:24pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/2 "2023-02-10T20:24:29Z")

</div>

Hi @dougleenhoutsvivint

Are you using the oauth2 option in the Authorization tab?

You should be able to use the “Token Name” as a variable

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/a/ea9bad5bd2f5da901067810e441730ab44fef0cc.png)

---

<div class="post-metadata">

**Author:** ![dougleenhoutsvivint](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@dougleenhoutsvivint](https://community.postman.com/u/dougleenhoutsvivint)\
**Post date:** [February 10, 2023, 8:38pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/3 "2023-02-10T20:38:23Z")

</div>

I am using the Authorization tab - but before you get the token you have to pass in a username/password, either in a Postman popup, or in a browser if you’ve got “Authorize using browser” selected.

How do I pass a username/password into those fields programmatically?

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [February 10, 2023, 9:11pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/4 "2023-02-10T21:11:45Z")

</div>

your endpoint must behave differently to the one I use for work as when I feed it a clientID and clientSecret I don’t get a redirect like you describe.

---

<div class="post-metadata">

**Author:** ![dougleenhoutsvivint](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@dougleenhoutsvivint](https://community.postman.com/u/dougleenhoutsvivint)\
**Post date:** [February 13, 2023, 4:24pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/5 "2023-02-13T16:24:10Z")

</div>

If you select “Authorize using browser”, then press the “Get New Access Token” (assuming cookies are cleared too), don’t you get redirected to a chrome/ff/IE/safari window with a username/pw prompt?

---

<div class="post-metadata">

**Author:** ![dougleenhoutsvivint](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@dougleenhoutsvivint](https://community.postman.com/u/dougleenhoutsvivint)\
**Post date:** [February 22, 2023, 5:27pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/6 "2023-02-22T17:27:40Z")

</div>

Anyone have any insight? There’s got to be a way to run a collection without having to manually enter a username and password, right?

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [March 7, 2023, 9:17am UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/7 "2023-03-07T09:17:11Z")

</div>

I have a call like this, that grabs a token using the client\_id / client\_secret.  
This doesn’t redirect, it just spits a bearer token into the response that I save as a variable and then pass in to all proceeding calls.

![image](https://us1.discourse-cdn.com/getpostman/original/3X/6/f/6fa7dd337873fcf9f9ff19ee0573209069215040.png)

---

<div class="post-metadata">

**Author:** ![Srinivas](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Srinivas](https://community.postman.com/u/Srinivas)\
**Post date:** [May 30, 2023, 2:27pm UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/8 "2023-05-30T14:27:38Z")

</div>

I also have similar issue. Looking for possible solution so that we can automate.

---

<div class="post-metadata">

**Author:** ![payload-engineer-762](https://avatars.discourse-cdn.com/v4/letter/p/e56c9b/32.png) [@payload-engineer-762](https://community.postman.com/u/payload-engineer-762)\
**Post date:** [July 5, 2023, 1:28am UTC](https://community.postman.com/t/login-credentials-in-oauth2-popup-window/43846/9 "2023-07-05T01:28:06Z")

</div>

I have similar issue. Basically this is REST endpoint implemented with OAuth2 workflow for Human Authentication.  
When we hit the endpoint, it will redirect to login website and ask for username/password,.  
Once we are authenticated, the login website will send a code to original frontend. Frontend will store this code as a Cookie and use it to authenticate with login website for real access token during subsequent request.

For normal REST endpoint protected by OIDC, then we can just give a Bearer Token, but this is not the case above.
