# Auto\_assign\_org and auto\_assign\_org\_id does not work for the users logging in with google auth

**URL:** <https://community.grafana.com/t/auto-assign-org-and-auto-assign-org-id-does-not-work-for-the-users-logging-in-with-google-auth/69276>\
**Category:** Configuration\
**Created:** [July 24, 2022, 5:45pm UTC](https://community.grafana.com/t/auto-assign-org-and-auto-assign-org-id-does-not-work-for-the-users-logging-in-with-google-auth/69276 "2022-07-24T17:45:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemantkhokhar](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@hemantkhokhar](https://community.grafana.com/u/hemantkhokhar)\
**Post date:** [July 24, 2022, 5:45pm UTC](https://community.grafana.com/t/auto-assign-org-and-auto-assign-org-id-does-not-work-for-the-users-logging-in-with-google-auth/69276/1 "2022-07-24T17:45:01Z")

</div>

Grafana Version: 5.x  
OS: Ubuntu 16

**What we need to achieve**

We have enabled google auth for the grafana user management, We have two organisation in the grafana

Default Org → org\_id =1  
Company Org → org\_id = 2

We want when the users logging in user google, they should be redirected to Company Org i.e. org\_id =2

**Changes we made**

I have tried setting up `auto_assign_org=true` and `auto_assign_org_id =2` in the users section of grafana.

**What happened?**

The users are still getting pointed to default org id 1 when logging using google auth

Note: If the users are logging directly on grafana without google auth, they are getting redirected to org\_id 2

The users should be redirected to org\_id 2.  
We believe there should be the similar flags `auto_assign_org ` and `auto_assign_org_id` somewhere in the auth.google config in grafana.ini

**Configuration Used**

```auto
[auth.google]
enabled = true
client_id = xxxxxxxxxxxxxxxx
client_secret = xxxxxxxxxxxxxx
scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
auth_url = https://accounts.google.com/o/oauth2/auth
token_url = https://accounts.google.com/o/oauth2/token
allowed_domains = xxx.in
allow_sign_up = true
allowed_organizations = xxx
org_name = xxx

```

```auto
[users]
;allow_sign_up = true
auto_assign_org = true
auto_assign_org_id = 2
;auto_assign_org_role = Viewer

```

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 24, 2022, 6:01pm UTC](https://community.grafana.com/t/auto-assign-org-and-auto-assign-org-id-does-not-work-for-the-users-logging-in-with-google-auth/69276/2 "2022-07-24T18:01:58Z")

</div>

Welcome

That is a very old version of grafana.

Can you spin up the latest in anew ubuntu and see if this issue persists

---

<div class="post-metadata">

**Author:** ![hemantkhokhar](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@hemantkhokhar](https://community.grafana.com/u/hemantkhokhar)\
**Post date:** [July 25, 2022, 6:24am UTC](https://community.grafana.com/t/auto-assign-org-and-auto-assign-org-id-does-not-work-for-the-users-logging-in-with-google-auth/69276/3 "2022-07-25T06:24:17Z")

</div>

Thanks, Yosiasz for the instant reply. can you help me with which grafana version I have to upgrade to achieve this ??  
Because I have tested same on with the grafana version 9.0.2

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [July 25, 2022, 1:04pm UTC](https://community.grafana.com/t/auto-assign-org-and-auto-assign-org-id-does-not-work-for-the-users-logging-in-with-google-auth/69276/4 "2022-07-25T13:04:04Z")

</div>

The issue persists in 9.0.2?

---

<div class="post-metadata">

**Author:** ![hemantkhokhar](https://avatars.discourse-cdn.com/v4/letter/h/8e7dd6/32.png) [@hemantkhokhar](https://community.grafana.com/u/hemantkhokhar)\
**Post date:** [July 25, 2022, 1:55pm UTC](https://community.grafana.com/t/auto-assign-org-and-auto-assign-org-id-does-not-work-for-the-users-logging-in-with-google-auth/69276/5 "2022-07-25T13:55:42Z")

</div>

yes, when user login via google auth always login in default org. i.e [main.org](http://main.org) still.
