Browse Source
Merge pull request #16535 from abpframework/auto-merge/rel-7-1/1938
Merge branch rel-7.2 with rel-7.1
pull/16536/head
Masum ULU
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
22 additions and
2 deletions
-
npm/ng-packs/packages/identity/package.json
-
templates/app/react-native/src/api/AccountAPI.js
|
|
|
@ -9,6 +9,7 @@ |
|
|
|
"dependencies": { |
|
|
|
"@abp/ng.permission-management": "~7.2.1", |
|
|
|
"@abp/ng.theme.shared": "~7.2.1", |
|
|
|
"@abp/ng.components": "~7.2.1", |
|
|
|
"tslib": "^2.0.0" |
|
|
|
}, |
|
|
|
"publishConfig": { |
|
|
|
|
|
|
|
@ -3,15 +3,34 @@ import { getEnvVars } from '../../Environment'; |
|
|
|
|
|
|
|
const { oAuthConfig } = getEnvVars(); |
|
|
|
|
|
|
|
getLoginData = (username, password) => { |
|
|
|
|
|
|
|
const formData = { |
|
|
|
grant_type: 'password', |
|
|
|
scope: oAuthConfig.scope, |
|
|
|
username: username, |
|
|
|
password: password, |
|
|
|
client_id: oAuthConfig.clientId |
|
|
|
}; |
|
|
|
|
|
|
|
if (oAuthConfig.clientSecret) |
|
|
|
formData['client_secret'] = oAuthConfig.clientSecret; |
|
|
|
|
|
|
|
return Object.entries(formData) |
|
|
|
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`) |
|
|
|
.join('&'); |
|
|
|
} |
|
|
|
|
|
|
|
export const login = ({ username, password }) => |
|
|
|
api({ |
|
|
|
method: 'POST', |
|
|
|
url: '/connect/token', |
|
|
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, |
|
|
|
data: `grant_type=password&scope=${oAuthConfig.scope}&username=${username}&password=${password}&client_id=${oAuthConfig.clientId}&client_secret=${oAuthConfig.clientSecret}`, |
|
|
|
baseURL: oAuthConfig.issuer, |
|
|
|
data: getLoginData(username, password), |
|
|
|
baseURL: oAuthConfig.issuer |
|
|
|
}).then(({ data }) => data); |
|
|
|
|
|
|
|
|
|
|
|
export const Logout = () => |
|
|
|
api({ |
|
|
|
method: 'GET', |
|
|
|
|