2014-01-15 22 views
13

我想用RAML描述使用的OAuth2如何使用腎錯構瘤中使用OAuth2

有沒有人有一個解決方案或例子,我可以用我自己的錯構瘤比較對我的API的API來描述的API?

+0

爲什麼這個封閉? – Nikos

+0

關閉原因突出顯示在上方:您的問題是脫離主題,因爲它請求非現場資源。 – njuffa

+0

@njuffa我問一個解決方案,我得到了一個受歡迎的答案!這不是這個網站的目的? – Nikos

回答

12

https://github.com/raml-org/raml-spec/blob/master/08_security.md#declaration

 
securitySchemes: 
    - oauth_2_0: 
     description: | 
      Dropbox supports OAuth 2.0 for authenticating all API requests. 
     type: OAuth 2.0 
     describedBy: 
      headers: 
       Authorization: 
        description: | 
         Used to send a valid OAuth 2 access token. Do not use 
         with the "access_token" query string parameter. 
        type: string 
      queryParameters: 
       access_token: 
        description: | 
         Used to send a valid OAuth 2 access token. Do not use together with 
         the "Authorization" header 
        type: string 
      responses: 
       401: 
        description: | 
         Bad or expired token. This can happen if the user or Dropbox 
         revoked or expired an access token. To fix, you should re- 
         authenticate the user. 
       403: 
        description: | 
         Bad OAuth request (wrong consumer key, bad nonce, expired 
         timestamp...). Unfortunately, re-authenticating the user won't help here. 
     settings: 
      authorizationUri: https://www.dropbox.com/1/oauth2/authorize 
      accessTokenUri: https://api.dropbox.com/1/oauth2/token 
      authorizationGrants: [ code, token ] 
+0

這是爲我raml 0.8標準我想。什麼是有效的聲明看起來像1.0? –

相關問題