Skip to content

Save access/auth token easier with AccountManager + Authenticator

Notifications You must be signed in to change notification settings

jecsan/gatekeeper

Repository files navigation

GateKeeper

AccountManager simplified. Initialize GateKeeper

 val gateKeeper = GateKeeper(context)

Save user credentials

  gateKeeper.enter(accountName: String, authToken: String) 

Clear saved user credentials

  gateKeeper.logout()

Usage

root build.gradle

	allprojects {
		repositories {
			//...
			maven { url 'https://jitpack.io' }
		}
	}

app build.gradle

    dependencies{
        implementation 'com.github.jecsan:gatekeeper:1.0.5'
    }

In your strings.xml, add the following string:

    <string name="account_type">your_app_name</string>

Optional - For supporting multiple app installs

    debug{
            ....
            resValue "string", "account_type", "debug_account_type_here"
        }
    release{
            ....
            resValue "string", "account_type", "release_account_type_here"
        }

In your Application class, implement the Gate class and provide the activity that you will use for authentication/login.

class SampleApp : Application(), Gate {
    override fun getGateClass(): Class<*> {
        return LoginActivity::class.java
    }
}

About

Save access/auth token easier with AccountManager + Authenticator

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages