# magento 中的oauth/initiate 需要配置哪些文件？

**URL:** https://forum.magentochina.org/t/magento-%E4%B8%AD%E7%9A%84oauthinitiate-%E9%9C%80%E8%A6%81%E9%85%8D%E7%BD%AE%E5%93%AA%E4%BA%9B%E6%96%87%E4%BB%B6%EF%BC%9F/256
**Category:** Uncategorized
**Created:** [2018 年1 月 5 日 01:40 UTC](https://forum.magentochina.org/t/magento-%E4%B8%AD%E7%9A%84oauthinitiate-%E9%9C%80%E8%A6%81%E9%85%8D%E7%BD%AE%E5%93%AA%E4%BA%9B%E6%96%87%E4%BB%B6%EF%BC%9F/256 "2018-01-05T01:40:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### 作者： ![zjw](https://forum.magentochina.org/letter_avatar_proxy/v4/letter/z/dec6dc/32.png) [@zjw](https://forum.magentochina.org/u/zjw)
#### 发布日期： [2018 年1 月 5 日 01:40 UTC](https://forum.magentochina.org/t/magento-%E4%B8%AD%E7%9A%84oauthinitiate-%E9%9C%80%E8%A6%81%E9%85%8D%E7%BD%AE%E5%93%AA%E4%BA%9B%E6%96%87%E4%BB%B6%EF%BC%9F/256/1 "2018-01-05T01:40:33Z")

</div>

![](https://forum.magentochina.org/uploads/default/original/1X/f1105bd17cab5da389669b337649daabf740f82d.png)认证第一步，会报这个错，什么鬼？

---

<div class="post-metadata">

### 作者： ![Shuai](https://forum.magentochina.org/user_avatar/forum.magentochina.org/shuai/32/3_2.png) [@Shuai](https://forum.magentochina.org/u/Shuai)
#### 发布日期： [2018 年1 月 5 日 02:13 UTC](https://forum.magentochina.org/t/magento-%E4%B8%AD%E7%9A%84oauthinitiate-%E9%9C%80%E8%A6%81%E9%85%8D%E7%BD%AE%E5%93%AA%E4%BA%9B%E6%96%87%E4%BB%B6%EF%BC%9F/256/2 "2018-01-05T02:13:35Z")

</div>

正确的访问的方法应该是POST，你直接GET访问，肯定会有问题。建议多看文档。  
[https://doc.magentochina.org/guides/m1x/api/rest/authentication/oauth\_authentication.html#OAuthAuthentication-UsingOAuth](https://doc.magentochina.org/guides/m1x/api/rest/authentication/oauth_authentication.html#OAuthAuthentication-UsingOAuth)

需要先进入Magento配置访问的密钥

##Registering an Application  
Before starting to make API requests, you need to register the application. After the registration, you will receive the Consumer Key that will identify you in Magento. Also, you will receive a Consumer Secret. This secret will be used when requesting for a Request Token.

You can register your application by selecting **System \> Web Services \> REST - OAuth Consumers** and clicking **Add New** in the Admin Panel.

When registering the application, you also need to define the callback URL, to which the user will be redirected after he/she successfully authorizes your application.

##Authentication Endpoints  
The authentication endpoints include the following ones:

- /oauth/initiate - this endpoint is used for retrieving the Request Token.
- /oauth/authorize - this endpoint is used for user authorization (Customer).
- /admin/oauth\_authorize - this endpoint is used for user authorization (Admin).
- /oauth/token - this endpoint is used for retrieving the Access Token.  
Also, the simple form can be used for authentication. To use a simple form, add the /simple endpoint to the authentication endpoint. For example: /oauth/authorize/simple
