# Batch Edit Authorization Type

**URL:** <https://community.postman.com/t/batch-edit-authorization-type/8327>\
**Category:** Help Hub\
**Tags:** collections, authentication\
**Created:** [October 11, 2019, 8:27pm UTC](https://community.postman.com/t/batch-edit-authorization-type/8327 "2019-10-11T20:27:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshua](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@joshua](https://community.postman.com/u/joshua)\
**Post date:** [October 11, 2019, 8:27pm UTC](https://community.postman.com/t/batch-edit-authorization-type/8327/1 "2019-10-11T20:27:39Z")

</div>

I just imported my OAS 2.0 spec to Postman and it created a collection. All of the requests have an authorization type of “No Auth”. I’d like to change them all to “Bearer Token” without editing every request.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 11, 2019, 9:41pm UTC](https://community.postman.com/t/batch-edit-authorization-type/8327/2 "2019-10-11T21:41:32Z")

</div>

Hey @joshua,

Have you tried adding the Authorization at the Collection level?

[https://learning.getpostman.com/docs/postman/sending\_api\_requests/authorization/#inherit-auth-from-parent](https://learning.getpostman.com/docs/postman/sending_api_requests/authorization/#inherit-auth-from-parent)

---

<div class="post-metadata">

**Author:** ![joshua](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@joshua](https://community.postman.com/u/joshua)\
**Post date:** [October 11, 2019, 9:52pm UTC](https://community.postman.com/t/batch-edit-authorization-type/8327/3 "2019-10-11T21:52:31Z")

</div>

Yeah, but all of them are currently set to No Auth which is the default. I wish the default was inherit from parent.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [October 11, 2019, 9:59pm UTC](https://community.postman.com/t/batch-edit-authorization-type/8327/4 "2019-10-11T21:59:52Z")

</div>

If you set the Authorization at the Collection level to be Bearer Token and handle the Auth from there, the requests should pick that up.

Do you give it a go?

---

<div class="post-metadata">

**Author:** ![joshua](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@joshua](https://community.postman.com/u/joshua)\
**Post date:** [October 11, 2019, 10:11pm UTC](https://community.postman.com/t/batch-edit-authorization-type/8327/5 "2019-10-11T22:11:25Z")

</div>

I did that. When I imported the OAS file it set all of them to No Auth. That’s the default according to the documentation. I changed the collection to Bearer Token. Did not change all of the requests to Inherit from parent or Bearer Token.

---

<div class="post-metadata">

**Author:** ![singhsivcan](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/singhsivcan/32/1595_2.png) [@singhsivcan](https://community.postman.com/u/singhsivcan)\
**Post date:** [October 12, 2019, 6:46am UTC](https://community.postman.com/t/batch-edit-authorization-type/8327/6 "2019-10-12T06:46:20Z")

</div>

You can [`export`](https://learning.getpostman.com/docs/postman/collections/data_formats/) the collection, the exported collection is a JSON format.

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

Then you can open the exported `collection.json` file in an IDE (for eg. VSCode), and you’ll see that each request has a property called `auth`.

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

Just find all (VSCode lets you do a multiline find and replace) and **delete the entire `auth` object** , and then import the collection back into Postman, now all the requests will be inheriting from the parent (i.e collection in this case)

---

<div class="post-metadata">

**Author:** ![rob.cook](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/rob.cook/32/10880_2.png) [@rob.cook](https://community.postman.com/u/rob.cook)\
**Post date:** [January 16, 2022, 3:08pm UTC](https://community.postman.com/t/batch-edit-authorization-type/8327/7 "2022-01-16T15:08:22Z")

</div>

This workaround no longer appears to work.

If I remove the `auth` property from the request my request continues to have the auth property.

I created a simple collection with one get endpoint. The collection auth is set to OAuth2 and the request is originally set to noauth. This behavior happens when I create a collection from an api schema.

using `GET /collections/:collectionId` I receive:

```auto
{
    "collection": {
        "info": {
            "_postman_id": "b2346a78-65c2-428b-a7cf-14ec384e520e",
            "name": "AuthTest",
            "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
        },
        "item": [
            {
                "name": "get with auth",
                "id": "a2464652-85ad-4b45-ab00-8e25c64e2e80",
                "protocolProfileBehavior": {
                    "disableBodyPruning": true
                },
                "request": {
                    "auth": {
                        "type": "noauth"
                    },
                    "method": "GET",
                    "header": [],
                    "url": {
                        "raw": "https://example.com/path",
                        "protocol": "https",
                        "host": [
                            "example",
                            "com"
                        ],
                        "path": [
                            "path"
                        ]
                    }
                },
                "response": []
            }
        ],
        "auth": {
            "type": "oauth2",
            "oauth2": [
                {
                    "key": "addTokenTo",
                    "value": "header",
                    "type": "string"
                }
            ]
        },
        "event": [
            {
                "listen": "prerequest",
                "script": {
                    "id": "31d30429-ada1-4e40-90b4-1a8d99945aa8",
                    "type": "text/javascript",
                    "exec": [
                        ""
                    ]
                }
            },
            {
                "listen": "test",
                "script": {
                    "id": "28e72b7d-872f-4061-89d4-307a2cbbb59a",
                    "type": "text/javascript",
                    "exec": [
                        ""
                    ]
                }
            }
        ]
    }
}

```

Editing the request and sending the following body to `PUT /collections/:collectionId`

```auto
{
    "collection": {
        "info": {
            "_postman_id": "b2346a78-65c2-428b-a7cf-14ec384e520e",
            "name": "AuthTest",
            "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
        },
        "item": [
            {
                "name": "get with auth",
                "id": "a2464652-85ad-4b45-ab00-8e25c64e2e80",
                "protocolProfileBehavior": {
                    "disableBodyPruning": true
                },
                "request": {
                    "method": "GET",
                    "header": [],
                    "url": {
                        "raw": "https://example.com/path",
                        "protocol": "https",
                        "host": [
                            "example",
                            "com"
                        ],
                        "path": [
                            "path"
                        ]
                    }
                },
                "response": []
            }
        ],
        "auth": {
            "type": "oauth2",
            "oauth2": [
                {
                    "key": "addTokenTo",
                    "value": "header",
                    "type": "string"
                }
            ]
        },
        "event": [
            {
                "listen": "prerequest",
                "script": {
                    "id": "31d30429-ada1-4e40-90b4-1a8d99945aa8",
                    "type": "text/javascript",
                    "exec": [
                        ""
                    ]
                }
            },
            {
                "listen": "test",
                "script": {
                    "id": "28e72b7d-872f-4061-89d4-307a2cbbb59a",
                    "type": "text/javascript",
                    "exec": [
                        ""
                    ]
                }
            }
        ]
    }
}

```

I get a success response. However, making another `GET /collections/:collectionId` returns the original body with the request object having the auth set to noauth.

I can find no way of removing the auth property once it exists on a request object using the PUT endpoint for the collection. Is there any way to remove the auth property or set the property to inherit from parent? Using the postman client and setting the endpoint to Inherit from parent does the right thing but I want to do it via the API not using the client.

Thanks,  
Rob
