# 403 : Forbidden

**URL:** <https://discourse.jupyter.org/t/403-forbidden/22179>\
**Category:** JupyterHub\
**Created:** [October 31, 2023, 8:27am UTC](https://discourse.jupyter.org/t/403-forbidden/22179 "2023-10-31T08:27:15Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pramod\_Lomte](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pramod_lomte/32/10715_2.png) [@Pramod\_Lomte](https://discourse.jupyter.org/u/Pramod_Lomte)\
**Post date:** [October 31, 2023, 8:27am UTC](https://discourse.jupyter.org/t/403-forbidden/22179/1 "2023-10-31T08:27:15Z")

</div>

I am working with jupyterhub and I configured authentication class as ( c.JupyterHub.authenticator\_class = ‘oauthenticator.gitlab.LocalGitLabOAuthenticator’) but when I am trying to login remote user its throwing an below error

# 403 : Forbidden

Sorry, you are not currently authorized to use this hub. Please contact the hub administrator.

---

<div class="post-metadata">

**Author:** ![mahendrapaipuri](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mahendrapaipuri/32/6800_2.png) [@mahendrapaipuri](https://discourse.jupyter.org/u/mahendrapaipuri)\
**Post date:** [October 31, 2023, 9:14am UTC](https://discourse.jupyter.org/t/403-forbidden/22179/2 "2023-10-31T09:14:13Z")

</div>

You need to post more details like hub logs and other relevant config. It is very hard to guess the issues from this limited information.

---

<div class="post-metadata">

**Author:** ![Pramod\_Lomte](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pramod_lomte/32/10715_2.png) [@Pramod\_Lomte](https://discourse.jupyter.org/u/Pramod_Lomte)\
**Post date:** [October 31, 2023, 12:10pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/3 "2023-10-31T12:10:06Z")

</div>

Hi [mahendrapaipuri](https://discourse.jupyter.org/t/403-forbidden/22179/2) Below are the logs

[W 2023-10-31 12:08:11.987 JupyterHub auth:532] User ‘harshal.raghatate.work’ not allowed.  
[W 2023-10-31 12:08:11.987 JupyterHub base:825] Failed login for unknown user  
[W 2023-10-31 12:08:11.987 JupyterHub web:1869] 403 GET /hub/oauth\_callback?code=44937f6e6c8e2a514cff18a9f5d9c58626c927708aa75d0a46bd9f6358e8588b&state=eyJzdGF0ZV9pZCI6ICIyNTE2MjNiZTdiYTk0YWZiOGRkNTFhNGFkOGYzNDk0ZCJ9 (110.224.115.111): Sorry, you are not currently authorized to use this hub. Please contact the hub administrator.  
[W 2023-10-31 12:08:11.988 JupyterHub log:186] 403 GET /hub/oauth\_callback?code=[secret]&state=[secret] (@110.224.115.111) 801.62ms

---

<div class="post-metadata">

**Author:** ![mahendrapaipuri](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mahendrapaipuri/32/6800_2.png) [@mahendrapaipuri](https://discourse.jupyter.org/u/mahendrapaipuri)\
**Post date:** [October 31, 2023, 12:31pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/4 "2023-10-31T12:31:26Z")

</div>

Can you try to set config `c.Authenticator.allowed_users = {'harshal.raghatate.work'}`? If it works, either you need to add all the users that need to that set or use an empty set to allow _all_ the users.

---

<div class="post-metadata">

**Author:** ![Pramod\_Lomte](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pramod_lomte/32/10715_2.png) [@Pramod\_Lomte](https://discourse.jupyter.org/u/Pramod_Lomte)\
**Post date:** [October 31, 2023, 12:51pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/5 "2023-10-31T12:51:42Z")

</div>

Hi, this is working by hardcoding but its quite hard to manage every user details in jupyter\_config.py

---

<div class="post-metadata">

**Author:** ![mahendrapaipuri](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mahendrapaipuri/32/6800_2.png) [@mahendrapaipuri](https://discourse.jupyter.org/u/mahendrapaipuri)\
**Post date:** [October 31, 2023, 12:59pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/6 "2023-10-31T12:59:03Z")

</div>

If you use `c.Authenticator.allowed_users ={}`, it will allow all users. If you need a more fine grained access control, you will have to override [check\_allowed](https://github.com/jupyterhub/oauthenticator/blob/9ff045378dfb2235f79bfffdc3a3ce1148b2ac3f/oauthenticator/oauth2.py#L990-L1022) method to implement your custom logic

---

<div class="post-metadata">

**Author:** ![Pramod\_Lomte](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pramod_lomte/32/10715_2.png) [@Pramod\_Lomte](https://discourse.jupyter.org/u/Pramod_Lomte)\
**Post date:** [October 31, 2023, 1:09pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/7 "2023-10-31T13:09:01Z")

</div>

Hi, If I enable _c.Authenticator.allowed\_users ={}_ then its throwing an below error  
File “/datadrive/miniconda3/lib/python3.11/site-packages/traitlets/traitlets.py”, line 2314, in validate  
self.error(obj, value)  
File “/datadrive/miniconda3/lib/python3.11/site-packages/traitlets/traitlets.py”, line 833, in error  
raise TraitError(e)  
traitlets.traitlets.TraitError: The ‘allowed\_users’ trait of a LocalGitLabOAuthenticator instance expected a set, not the dict {}.

---

<div class="post-metadata">

**Author:** ![mahendrapaipuri](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mahendrapaipuri/32/6800_2.png) [@mahendrapaipuri](https://discourse.jupyter.org/u/mahendrapaipuri)\
**Post date:** [October 31, 2023, 1:14pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/8 "2023-10-31T13:14:42Z")

</div>

My bad, it should be a set as the error suggests. So, it should b e `c.Authenticator.allowed_users = set()`

---

<div class="post-metadata">

**Author:** ![Pramod\_Lomte](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pramod_lomte/32/10715_2.png) [@Pramod\_Lomte](https://discourse.jupyter.org/u/Pramod_Lomte)\
**Post date:** [October 31, 2023, 1:18pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/9 "2023-10-31T13:18:04Z")

</div>

Still I am getting the same error  
[W 2023-10-31 13:16:46.790 JupyterHub auth:532] User ‘priya.sachan.work’ not allowed.  
[W 2023-10-31 13:16:46.790 JupyterHub base:825] Failed login for unknown user  
[W 2023-10-31 13:16:46.790 JupyterHub web:1869] 403 GET /hub/oauth\_callback?code=215967a1567c789eadbf73b94769330ef7d1e6afe6d8cababbb7195239572426&state=eyJzdGF0ZV9pZCI6ICIzNjRiYjA0YjE0MDU0OWQ5YmJlYTM5MWZlMDYxMTFlZiJ9 (110.224.118.60): Sorry, you are not currently authorized to use this hub. Please contact the hub administrator.

---

<div class="post-metadata">

**Author:** ![mahendrapaipuri](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/mahendrapaipuri/32/6800_2.png) [@mahendrapaipuri](https://discourse.jupyter.org/u/mahendrapaipuri)\
**Post date:** [October 31, 2023, 1:21pm UTC](https://discourse.jupyter.org/t/403-forbidden/22179/10 "2023-10-31T13:21:30Z")

</div>

Seems like `OAuthenticator` has one more [config](https://github.com/jupyterhub/oauthenticator/blob/9ff045378dfb2235f79bfffdc3a3ce1148b2ac3f/oauthenticator/oauth2.py#L265) parameter to control this beahviour. You need to set `c.OAuthenticator.allow_all = True`

---

<div class="post-metadata">

**Author:** ![Pramod\_Lomte](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/pramod_lomte/32/10715_2.png) [@Pramod\_Lomte](https://discourse.jupyter.org/u/Pramod_Lomte)\
**Post date:** [November 1, 2023, 5:04am UTC](https://discourse.jupyter.org/t/403-forbidden/22179/11 "2023-11-01T05:04:18Z")

</div>

Hi @mahendrapaipuri Thanks for the help, it’s working now
