# Identity entity must be associated with the request

**URL:** <https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900>\
**Category:** Vault\
**Created:** [January 13, 2023, 6:02am UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900 "2023-01-13T06:02:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![periyasamy6791](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/periyasamy6791/32/17994_2.png) [@periyasamy6791](https://discuss.hashicorp.com/u/periyasamy6791)\
**Post date:** [January 13, 2023, 6:02am UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900/1 "2023-01-13T06:02:03Z")

</div>

Hello everyone,  
Hope you are doing fine.

I am using vault v 1.12.2.  
I am trying to use vault itself as OIDC provider feature.  
I am following below article.

> **[OIDC Identity Provider | Vault | HashiCorp Developer](https://developer.hashicorp.com/vault/api-docs/secret/identity/oidc-provider)**
>
> This is the API documentation for configuring and managing OIDC providers with Vault.

I am able to use the apis like (key,entity,group,assignment,client,provider,scope).  
But when i try to use /authorize endpoint i am getting "  
**identity entity must be associated with the request**" validation message. When i see the source code of vault , EntityID needs to be supplied as part of the authorize request. But i dont know how to send the **EntityID** as part of the request. I mean in header or body or param?

I am using postman to test the flow.

**Sample request url:**  
[https://localhost:8200/v1/identity/oidc/provider/test-provider/authorize?response\_type=code&client\_id=kE2dZMcuPkBjSv7u36y2uT0YRGw7s8zK&state=abcdefg&nonce=hijklmn&scope=openid&redirect\_uri=http://localhost:41330/callback](https://localhost:8200/v1/identity/oidc/provider/test-provider/authorize?response_type=code&client_id=kE2dZMcuPkBjSv7u36y2uT0YRGw7s8zK&state=abcdefg&nonce=hijklmn&scope=openid&redirect_uri=http://localhost:41330/callback)

Please help me on this issue.

Thanks  
Samy

---

<div class="post-metadata">

**Author:** ![periyasamy6791](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/periyasamy6791/32/17994_2.png) [@periyasamy6791](https://discuss.hashicorp.com/u/periyasamy6791)\
**Post date:** [January 13, 2023, 11:38am UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900/2 "2023-01-13T11:38:15Z")

</div>

@austingebauer could you please assist on this one?

---

<div class="post-metadata">

**Author:** ![austingebauer](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/austingebauer/32/33080_2.png) [@austingebauer](https://discuss.hashicorp.com/u/austingebauer)\
**Post date:** [January 13, 2023, 6:40pm UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900/3 "2023-01-13T18:40:39Z")

</div>

The Vault token you provide to the /authorize endpoint must have an identity entity associated with it. Which Vault token are using to authenticate the request?

Also, is there a reason that you’re trying to interact with the /authorize endpoint directly? Generally, this interaction is handled within the OIDC flow which involves a browser. I’d say you’re likely using the OIDC provider incorrectly if you’re interacting with the /authorize endpoint via something like postman.

---

<div class="post-metadata">

**Author:** ![periyasamy6791](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/periyasamy6791/32/17994_2.png) [@periyasamy6791](https://discuss.hashicorp.com/u/periyasamy6791)\
**Post date:** [January 14, 2023, 2:29pm UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900/4 "2023-01-14T14:29:57Z")

</div>

@austingebauer Thank you very much for your quick response…

I am new to use Vault as OIDC identity provider. I am following below steps. Kindly refer and let me know if i am missing any steps.

Initialized and unsealed the Vault and i got **Root-Token** and **master keys**

**Step 1:** I am using **Root-Token** to perform following operations.  
**Step 2:** Create a key  
**Request:**  
Data: map[string]interface{}{  
“allowed\_client\_ids”: \*,  
“algorithm”: RS256,  
}

**Step 3:** Create an entity  
**Request:**  
Data: map[string]interface{}{  
“name”: “test-entity”,  
“metadata”: map[string]string{  
“email”: “[test@hashicorp.com](mailto:test@hashicorp.com)”,  
“phone\_number”: “123-456-7890”,  
},  
}  
**Step 4:** Create a group  
**Request:**  
Data: map[string]interface{}{  
“name”: name,  
“member\_entity\_ids”: Step 3 entity id,  
“member\_group\_ids”: null,  
}  
**Step 5:** Create an assignment  
Data: map[string]interface{}{  
“entity\_ids”: string{Step 3 entity id},  
“group\_ids”: string{Step 4 groupID},  
}  
**Step 6:** Create a client  
Data: map[string]interface{}{  
“key”: “Step 2 key”,  
“redirect\_uris”: string{“[https://localhost:8251/callback](https://localhost:8251/callback)”},  
“assignments”: string{“Step 5 assignment”},  
“id\_token\_ttl”: “24h”,  
“access\_token\_ttl”: “24h”,  
}  
**Step 7:** Create a custom scope  
Data: map[string]interface{}{  
“template”: “groups”: {{identity.entity.groups.names}},  
}

**Step 8:** Create a provider  
Data: map[string]interface{}{  
“allowed\_client\_ids”: string{Step 6 clientID},  
“scopes\_supported”: string{" Step 7 scope"},  
}  
**Step 9:** Invoke Authorize endpoint.  
Data: map[string]interface{}{  
“client\_id”: Step 6 clientID,  
“scope”: “openid”,  
“redirect\_uri”: “[https://localhost:8251/callback](https://localhost:8251/callback)”,  
“response\_type”: “code”,  
“state”: “abcdefg”,  
“nonce”: “hijklmn”,  
}  
During this endpoint invocation i am getting **Identity entity must be associated with the request** validation message.

How do i associate entity with vault root token? Or do i need to generate any other vault token to perform these operations?

I am referring **identity\_store\_oidc\_provider\_test.go** source file from vault source code and **TestOIDC\_Path\_OIDC\_Authorize** method.

Please provide some advice on this.

**Note:**

1. I am using Postman to testing the flow.
2. I am using vault 1.12.2 version.

Thanks & Regards  
Samy

---

<div class="post-metadata">

**Author:** ![maxb](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/maxb/32/26655_2.png) [@maxb](https://discuss.hashicorp.com/u/maxb)\
**Post date:** [January 14, 2023, 8:31pm UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900/5 "2023-01-14T20:31:42Z")

</div>

> [@periyasamy6791](#):
>
> How do i associate entity with vault root token?

You cannot do this. Instead you must enable and configure an auth method in Vault, then log in using the auth method.

Having done so, your login will then be associated with an entity in the Vault identity system - unlike a root token.

---

<div class="post-metadata">

**Author:** ![periyasamy6791](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/periyasamy6791/32/17994_2.png) [@periyasamy6791](https://discuss.hashicorp.com/u/periyasamy6791)\
**Post date:** [January 16, 2023, 4:27pm UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900/6 "2023-01-16T16:27:31Z")

</div>

Thank you @maxb , I am able to progress. I have enabled Auth method (userpass) and created new user. Associated this user with another entity and used current user token to make /authorize request and got success.

---

<div class="post-metadata">

**Author:** ![periyasamy6791](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/periyasamy6791/32/17994_2.png) [@periyasamy6791](https://discuss.hashicorp.com/u/periyasamy6791)\
**Post date:** [January 18, 2023, 10:47am UTC](https://discuss.hashicorp.com/t/identity-entity-must-be-associated-with-the-request/48900/7 "2023-01-18T10:47:04Z")

</div>

@maxb i have tested end-to-end flow once and got success. But i have one doubt that is, how the Auth method users are automatically linked with vault OIDC entity?
