Skip to content

For basic JWT authentication services on the client code (requires jquery)

Notifications You must be signed in to change notification settings

aaronucsd/BaseAuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

BaseAuth

For basic JWT authentication services on the client

BaseAuth

Simple authentication services for login/logout

company.services.auth or easy access with BaseAuth
Requirements: Jquery

  • To authenticate on login
  		window.company.services.BaseAuth.login() 
  • To authenticate on logout
    	window.company.services.BaseAuth.logout() 
  • To authenticate only
  		window.company.services.BaseAuth.isAuthenticated()
  • To getToken
  		var token = window.company.services.BaseAuth.getToken()
Note: can change 'company' to your domain name

TESTS: or global access from window, and namespace access

var oneAuth = new window.company.services.BaseAuth({
     serverUrl: "http://localhost:8081"
   });

console.log(oneAuth.isAuthenticated());
console.log(oneAuth.getToken());
  • mock login
console.log(oneAuth.login({username: "longh",password: "password"}));
console.log(oneAuth.isAuthenticated());
console.log(oneAuth.getToken());
console.log(oneAuth.getServerUrl());
  • mock logout
console.log(oneAuth.logout());
console.log(oneAuth.isAuthenticated());
console.log(oneAuth.getToken());

About

For basic JWT authentication services on the client code (requires jquery)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published