文档
测试

loginByOauth

POST
api/v1/loginByOauth

接口描述

第三方登陆

请求参数

参数名
类型
描述
必填
code
string
登录时获取的 code
必填

php请求demo

$client = new \GuzzleHttp\Client(); $response = $client->post( 'http://sns.shenruxiang.com/api/v1/loginByOauth', [ 'headers' => [ 'Content-Type' => 'application/json', 'Accept' => 'application/json', ], 'json' => [ 'code' => 'saepe', ], ] ); $body = $response->getBody(); print_r(json_decode((string) $body));

JS请求demo

const url = new URL( "http://sns.shenruxiang.com/api/v1/loginByOauth" ); let headers = { "Content-Type": "application/json", "Accept": "application/json", }; let body = { "code": "saepe" } fetch(url, { method: "POST", headers: headers, body: body }) .then(response => response.json()) .then(json => console.log(json));

返回值

{ "code": 0, "msg": "请求成功", "data": { "id": 84, "user_name": "1599482388989", "nick": "昵称", "avatar": "\/avatar.jpg", "phone": "13012796666", "status": 1, "wechat": "", "openid": "w32132131111sxfds11", "province": "河北", "city": "石家庄", "token": "61abfba8a5a61b6c3a018af43607ef9e", "login_time": "2020-09-07 12:41:49", "expire_time": 1608122509, "created_at": "2020-09-07 12:39:48", "session_key": null } }

bash

curl -X POST \ "http://sns.shenruxiang.com/api/v1/loginByOauth" \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"code":"saepe"}'