# How to make object classes available in GraphQL

**URL:** <https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603>\
**Category:** Ask the community\
**Created:** [August 10, 2023, 8:56am UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603 "2023-08-10T08:56:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![huuse](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@huuse](https://community.appfarm.io/u/huuse)\
**Post date:** [August 10, 2023, 8:56am UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603/1 "2023-08-10T08:56:58Z")

</div>

Hi, I want to query object ‘pin’ in Test environment in GraphQL.

pin is enabled for GraphQL.  
My user is Superuser, should it should have access to the object.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/c2c7d189eea4791a42dddbef57ac36741a684a72.png)  
The test environment is GraphQL enabled  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/291019683b14ad194968733e80399a553c63ae5f.png)

Opening GraphQL for test environment and running

```auto
{
	CurrentUser
}

```

returns data.

While running

```auto
{
	pin
}

```

returns

```auto
{
  "errors": [
    {
      "message": "Cannot query field \"pin\" on type \"RootQueryType\".",
      "locations": [
        {
          "line": 33,
          "column": 2
        }
      ]
    }
  ]
}

```

I can see in the Docs in GraphQL, that pin does not appear as a source:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/3113e561500b183b30ea1fcd04f910ae392c04b1.png)

What am I doing wrong here?

---

<div class="post-metadata">

**Author:** ![huuse](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@huuse](https://community.appfarm.io/u/huuse)\
**Post date:** [August 10, 2023, 9:13am UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603/2 "2023-08-10T09:13:52Z")

</div>

Maybe the changes needs to be deployed in Test. But, if I try the same in Development

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/e7f25bc03fc9992e5597594e2a8d831b4fb2c663.png)  
GraphQL won’t open properly. The link returns:

```auto
{"error":{"name":"MissingTokenError","message":"Unable to find token in request","code":13001,"statusCode":401},"code":13001,"message":"Unable to find token in request"}

```

---

<div class="post-metadata">

**Author:** ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)\
**Post date:** [August 10, 2023, 10:20am UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603/3 "2023-08-10T10:20:39Z")

</div>

Hi!

Seems like you are not redirected to the loginpage if you try to browse the graphql explorer without being logged in to the client. We’re registering a challenge on that one.  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/5253ee8def0467c01a78b9f56003e6f78c4a38eb.png)

Try to access an App in the same environment first, and then launch the graphql explorer!

---

<div class="post-metadata">

**Author:** ![huuse](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@huuse](https://community.appfarm.io/u/huuse)\
**Post date:** [August 10, 2023, 12:06pm UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603/4 "2023-08-10T12:06:30Z")

</div>

Thank you, Kristian.

---

<div class="post-metadata">

**Author:** ![huuse](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@huuse](https://community.appfarm.io/u/huuse)\
**Post date:** [August 14, 2023, 8:48am UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603/5 "2023-08-14T08:48:15Z")

</div>

Hi, I’m not able to “Reference Objects” in my query in GraphQL.

I Have an object “administrator” where “organization” is a field. I want to get name from organization from administrator. When I run:

```auto
{administrator {
  _id
  organization {
    name
  }
  user
  profileImage
  role
  af_createdDate
  af_updatedDate
}}

```

I get:

```auto
{
  "errors": [
    {
      "message": "Field \"organization\" must not have a selection since type \"String\" has no subfields.",
      "locations": [
        {
          "line": 3,
          "column": 16
        }
      ]
    }
  ]
}

```

Why does it treat organization as a string? I understand that it is represented as a string, but I want to reference the object organization. administrator.organization points to the object organization:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/appfarm/original/1X/5ded3e6ad07301d0e2d7e226728bf0e8044ff084.png)

What am I missing?

---

<div class="post-metadata">

**Author:** ![huuse](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@huuse](https://community.appfarm.io/u/huuse)\
**Post date:** [August 14, 2023, 8:53am UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603/6 "2023-08-14T08:53:58Z")

</div>

got it, need to use organization\_reference!

---

<div class="post-metadata">

**Author:** ![huuse](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@huuse](https://community.appfarm.io/u/huuse)\
**Post date:** [August 14, 2023, 9:01am UTC](https://community.appfarm.io/t/how-to-make-object-classes-available-in-graphql/603/7 "2023-08-14T09:01:29Z")

</div>

Is there a way to query fields on the built in “user” object? I would like to get e.g. administrator.user.firstname
