# 获取用户 openid

#### &#x20;请求URL

* `https://p.mbd.pub/openid`

#### 请求方式

* GET

#### 请求参数

| **参数名**     | **必选** | **类型** | **说明**                                                                |
| ----------- | ------ | ------ | --------------------------------------------------------------------- |
| target\_url | 是      | string | 自动跳转地址，例如 [https://example.com?pid=123](https://example.com/?pid=123) |
| app\_id     | 是      | string | 你的app\_id                                                             |

假如需要接收 `openid` 的 url 是：

`http://www.example.com/abc?uid=32`

则直接通过浏览器跳转该 `url` 即可：

`https://p.mbd.pub/openid?app_id=1234567890&target_url=http://www.example.com/abc?uid=32`

完成 `openid` 获取后，微信浏览器会自动跳转至：

`http://www.example.com/abc?uid=32&openid=*************`
