Ray Lee 6 лет назад
Родитель
Сommit
a09908ef78
1 измененных файлов с 127 добавлено и 0 удалено
  1. 127 0
      omniauth_login_api.md

+ 127 - 0
omniauth_login_api.md

@@ -0,0 +1,127 @@
+#Member Center Oauth2 API Document
+##Hosts
+ - preparing: https://preparing.kdanmobile.com:3002/
+ - production: https://cloud.kdanmobile.com/
+
+##APIs
+###Request Url
+> **POST** api/v3/verification/through\_omniauth
+
+###Request Parameters
+####Required
+ - client_id, string
+ - client_secret, string
+ - provider, one of following string 
+   - facebook
+   - google\_oauth2
+   - twitter
+   - linkedin
+   - qq\_connect
+   - wechat
+   - microsoft_graph
+ - omniauth_token, string
+ - omniauth_secret **(only for twitter)**, string
+ - open_id **(only for qq\_connect, wechat)**, string
+ - bundle_id **(only for twitter)**, string
+
+####Optional
+ - email, string
+ - password, string
+
+###Response
+####Successful
+
+    {
+      "code":200,
+      "message":"ok",
+      "data": {
+        "current_time":"2017-07-14T08:15:46.120Z",
+        "account":"don.shieh@gmail.com",
+        "name":"謝東霖",
+        "email":"don.shieh@gmail.com",
+        "uuid":"cdff9f73-5ad0-4a32-b640-156c65bc9311",
+        "unconfirmed_email":null,
+        "is_developer":false,
+        "confirmed":true,
+        "bounced":false,
+        "complainted":false,
+        "created_at":"2017-07-13T08:35:04.558Z",
+        "version_email_log_release_time":"2015-05-15T00:00:00.000Z",
+        "profile_data":{
+          "icon_info":{
+            "icon_url":{
+              "100":"https://s3.amazonaws.com/kdanfile-dev/user-icon/defaults/user_icon_1_100.png",
+              "280":"https://s3.amazonaws.com/kdanfile-dev/user-icon/defaults/user_icon_1_280.png"
+            },
+            "icon_default_id":"icon1"
+          },
+          "display_name":null
+        },
+        "access_token": "9ce94b94044b01dba423c7746f1cbb369b344735ff69e01dfc8574246ddc6fc4",
+        "token_type": "bearer",
+        "expires_in": 172800,
+        "refresh_token": "9147a9fd7ecee6c8cada39805429d81f95fda40a9232dd5267b432fb5a3cb581"
+      }
+    }
+
+####Fail
+
+當第三方社群未提供email
+
+    {
+      "code":4025,
+      "message":"Email not available"
+    }
+
+當提供的email與password不匹配
+
+    {
+      "code":4026,
+      "message":"Invalid password"
+    }
+
+當用戶建立失敗導致無法產生token
+
+	{
+      "code":400,
+      "message":"Token generation failed"
+    }  
+    
+當第三方社群驗證失敗,或提供格式有誤
+
+    {
+      "code":403,
+      "message":"Authorication failed"
+    }
+當client\_id或client\_secret不正確
+
+    {
+      "code":403,
+      "message":"Not authorized client"
+    }
+    
+###Request Url
+> **POST** api/v3/verification/email\_existed
+###Request Parameters
+####Required
+ - client_id, string
+ - client_secret, string
+ - email, string
+###Response
+####Successful
+    {
+      "code":200,
+      "message":"ok",
+      "data": true
+    }
+or
+
+    {
+      "code":200,
+      "message":"ok",
+      "data": false
+    }
+####Fail
+當伺服器無法回應
+
+    null