# 我想生成修改密码的ticket的url，可是一直报400错误

**URL:** <https://community.auth0.com/t/ticket-url-400/105368>\
**Category:** JWT.io\
**Tags:** password-change, password-reset\
**Created:** [April 24, 2023, 9:29am UTC](https://community.auth0.com/t/ticket-url-400/105368 "2023-04-24T09:29:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kixyouken](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kixyouken/32/46640_2.png) [@kixyouken](https://community.auth0.com/u/kixyouken)\
**Post date:** [April 24, 2023, 9:29am UTC](https://community.auth0.com/t/ticket-url-400/105368/1 "2023-04-24T09:29:50Z")

</div>

```auto
url := "https://test.xx.jp/api/v2/tickets/password-change"

payload := strings.NewReader("{\"user_id\": \"auth0|64265f14712a5faae1efefsfe\"}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "Bearer eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLWRldi5lbGdhbmEuanAvIn0..3sAOsAQeLiI3M5IK.c-deafda-pG1g0ZkbzX7LFv3ZRM8lI1Es7z_HdfJth-cz-JTRwrz1yBTp7Z7A2enVgpnNh4e3mJ_7YgOyqB9H8EKbWbded54WbEitSaFvcRiPxc3CC3mI0mvmZXtHgaD_bRju_x-8h09DIIX_h0u3hcwOE3DF_9Jb8uq4SrvXsO-Or-IgLt_kga3jeld-UrNb1yYh1rhLySDXOo5KBul-lV5qIb8aMkTXIwCZAFWncw9JgBLEfT_zVFx8gYV7AZ6A9mnmIkyOMxC7b_0mZyqefnMYqnu9M08.puvtlPKmBoBK1V58pnyTVQ")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(string(body))

```

输出结果为：

```auto
{"statusCode":400,"error":"Bad Request","message":"Bad HTTP authentication header format","errorCode":"Bearer"}

```

如果需要添加其他参数的话，应该加哪个，参数的值又是多少呢？ 🥶

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [April 25, 2023, 12:53pm UTC](https://community.auth0.com/t/ticket-url-400/105368/3 "2023-04-25T12:53:50Z")

</div>

Hi @kixyouken,

Welcome to the Auth0 Community!

The token you have listed here is an **encrypted** JWT and cannot be used against that endpoint.

To request a token for the management API you must include it’s API identifier with the request. That API identifier should be sent as the `audience` parameter.

```auto
audience=https://TENANT_NAME.auth0.com/api/v2/

```

> **[Get Management API Access Tokens for Production](https://auth0.com/docs/secure/tokens/access-tokens/get-management-api-access-tokens-for-production)**
>
> Learn how to get Access Tokens to make scheduled frequent calls to the Management API.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [June 16, 2023, 1:21pm UTC](https://community.auth0.com/t/ticket-url-400/105368/4 "2023-06-16T13:21:40Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
