1.0.0-rc.1 • Published 4 years ago
auth-service-js v1.0.0-rc.1
Auth Service JS Client
Library for Auth JWT Service.
How to contribute
- clone repository
- install dependencies
npm install
- use
npm run test:watch
to run test with--watch
mode - use
npm run build
to build library
Please, pay special attention: as far as we have a lack of abilities
to publish private npm
package for free to use auth-service-js
please run npm link ../auth-service-js
in your main project.
How to use
Autentificate user by Bitrix cookies
/*eslint-disable */
import authService from 'auth-service-js';
// initialize client with http client and base url, i.e. http://localhost:3000
const service = authService(http, 'http://localhost:3000');
// get JWT token
service.getTokenByCookies({
BX_USER_ID: '111', // you should get BX_USER_ID from cookie
PHPSESSID: '222', // you should get PHPSESSID from cookie
});
/* eslint-enable */
Refresh token
/*eslint-disable */
import authService from 'auth-service-js';
// initialize client with http client and base url, i.e. http://localhost:3000
const service = authService(http, 'http://localhost:3000');
// refresh JWT token
service.refreshToken(token);
/* eslint-enable */
1.0.0-rc.1
4 years ago