# Getting the location id during OAuth

**URL:** <https://developer.squareup.com/forums/t/getting-the-location-id-during-oauth/2628>\
**Category:** Questions\
**Tags:** oauth-api\
**Created:** [May 27, 2021, 6:43pm UTC](https://developer.squareup.com/forums/t/getting-the-location-id-during-oauth/2628 "2021-05-27T18:43:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mubasharabbas](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@mubasharabbas](https://developer.squareup.com/forums/u/mubasharabbas)\
**Post date:** [May 27, 2021, 6:43pm UTC](https://developer.squareup.com/forums/t/getting-the-location-id-during-oauth/2628/1 "2021-05-27T18:43:16Z")

</div>

Hi,

I am implementing the OAuth, and upon the success we get the authorization code, and the merchantId. We need the location id for which the app was authorized.

According to my understanding, a merchant can have multiple locations, so we would like to know the id of the location as well.  
How can we authorize for a single location rather than the entire business.

Thankyou.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [June 1, 2021, 3:18pm UTC](https://developer.squareup.com/forums/t/getting-the-location-id-during-oauth/2628/2 "2021-06-01T15:18:44Z")

</div>

Hi @mubasharabbas,

Yes, a merchant can have multiple locations with Square and once authorized you can call [ListLocations](https://developer.squareup.com/reference/square/locations-api/list-locations) to get all the existing locations. Currently the scope of access tokens is for they entire merchant account. They aren’t scoped to a single location.

---

<div class="post-metadata">

**Author:** ![wsadiq](https://avatars.discourse-cdn.com/v4/letter/w/ce73a5/32.png) [@wsadiq](https://developer.squareup.com/forums/u/wsadiq)\
**Post date:** [June 1, 2021, 9:56pm UTC](https://developer.squareup.com/forums/t/getting-the-location-id-during-oauth/2628/3 "2021-06-01T21:56:48Z")

</div>

Hi Bryan,

What if a merchant has multiple locations but they want to purchase/install/authorize an app for only one of those locations? The app that we are migrating to Square currently is subscribed to on a per location basis. Is that doable in Square?

---

<div class="post-metadata">

**Author:** ![wsadiq](https://avatars.discourse-cdn.com/v4/letter/w/ce73a5/32.png) [@wsadiq](https://developer.squareup.com/forums/u/wsadiq)\
**Post date:** [June 3, 2021, 1:55pm UTC](https://developer.squareup.com/forums/t/getting-the-location-id-during-oauth/2628/4 "2021-06-03T13:55:35Z")

</div>

Hi @Bryan-Square . Any thoughts. This is an issue for us for the following reasons:

1. There are many situations where a merchant has multiple locations but they may not want to purchase/authorize/install an application in all locations. For example, some locations may be owned by individual franchise owners who may not want some application.
2. We need to know the location id. Calling the api to list all locations and then have the user choose their location out of that list seems more error prone. Knowing some of these owners, it is conceivable that they will click on the incorrect location in a hurry 🙂

Look forward to hearing your response/thoughts.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [June 3, 2021, 3:59pm UTC](https://developer.squareup.com/forums/t/getting-the-location-id-during-oauth/2628/5 "2021-06-03T15:59:54Z")

</div>

Hi @wsadiq,

Unfortunately an access token that is scoped to a single location isn’t available with Square OAuth. You do bring up a valid concern however with Square’s account structure a merchant account that has multiple locations is owned by a single merchant. It isn’t structured to be a parent account with individually owned child accounts that have their own set of authorized applications that they use.
