1.0.9 • Published 2 years ago

frontend-authentication-module v1.0.9

Weekly downloads
-
License
Grubtech
Repository
-
Last release
2 years ago

Authentication Library

Handles authentication on grub eco system

Installation

npm install @grubtech/auth-library

Usaged

aws-amplify needs an amplify configuration

const amplifyConfig = {
  Auth: {
    region: process.env.REACT_APP_AWS_REGION,
    identityPoolRegion: process.env.REACT_APP_IDENTITY_POOL_REGION,
    userPoolId: process.env.REACT_APP_USER_POOL_ID,
    userPoolWebClientId: process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID,
  },
};

export default amplifyConfig;

Initiate an Authentication with the amplifier config

import {AuthenticationService} from '@grubtech/auth-library';
import amplifyConfig from "./amplifyConfig";

export const authObj = new AuthenticationService(amplifyConfig);

now use the 'authObj' as needed

import {authObj} from '../../../configs/authConfig';
const authResponse = await authObj.loginUser(values.email, values.password);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Grubtech