|
@@ -15,11 +15,15 @@
|
|
|
* Author: lengleng (wangiegie@gmail.com)
|
|
|
*/
|
|
|
import request from '@/router/axios'
|
|
|
+import qs from 'qs'
|
|
|
+
|
|
|
const scope = 'server'
|
|
|
|
|
|
export const loginByUsername = (username, password, code, randomStr) => {
|
|
|
- const grant_type = 'password'
|
|
|
+ let grant_type = 'password'
|
|
|
+ let dataObj = qs.stringify({'username': username, 'password': password})
|
|
|
|
|
|
+ console.log(dataObj)
|
|
|
return request({
|
|
|
url: '/auth/oauth/token',
|
|
|
headers: {
|
|
@@ -28,7 +32,8 @@ export const loginByUsername = (username, password, code, randomStr) => {
|
|
|
'Authorization': 'Basic cGlnOnBpZw=='
|
|
|
},
|
|
|
method: 'post',
|
|
|
- params: { username, password, randomStr, code, grant_type, scope }
|
|
|
+ params: {randomStr, code, grant_type},
|
|
|
+ data: dataObj
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -42,7 +47,7 @@ export const refreshToken = (refresh_token) => {
|
|
|
'Authorization': 'Basic cGlnOnBpZw=='
|
|
|
},
|
|
|
method: 'post',
|
|
|
- params: { refresh_token, grant_type, scope }
|
|
|
+ params: {refresh_token, grant_type, scope}
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -55,7 +60,7 @@ export const loginByMobile = (mobile, code) => {
|
|
|
'Authorization': 'Basic cGlnOnBpZw=='
|
|
|
},
|
|
|
method: 'post',
|
|
|
- params: { mobile: 'SMS@' + mobile, code: code, grant_type }
|
|
|
+ params: {mobile: 'SMS@' + mobile, code: code, grant_type}
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -68,7 +73,7 @@ export const loginBySocial = (state, code) => {
|
|
|
'Authorization': 'Basic cGlnOnBpZw=='
|
|
|
},
|
|
|
method: 'post',
|
|
|
- params: { mobile: state + '@' + code, grant_type }
|
|
|
+ params: {mobile: state + '@' + code, grant_type}
|
|
|
})
|
|
|
}
|
|
|
|