Webasyst auth

Webasyst auth client

License

License

https://www.gnu.org/licenses/lgpl-3.0.html
GroupId

GroupId

com.webasyst
ArtifactId

ArtifactId

auth
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

aar
Description

Description

Webasyst auth
Webasyst auth client
Project URL

Project URL

https://github.com/1312inc/Webasyst-X-Android-Library
Source Code Management

Source Code Management

https://github.com/1312inc/Webasyst-X-Android-Library

Download auth

How to add to project

<!-- https://jarcasting.com/artifacts/com.webasyst/auth/ -->
<dependency>
    <groupId>com.webasyst</groupId>
    <artifactId>auth</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.webasyst/auth/
implementation 'com.webasyst:auth:1.0.0'
// https://jarcasting.com/artifacts/com.webasyst/auth/
implementation ("com.webasyst:auth:1.0.0")
'com.webasyst:auth:aar:1.0.0'
<dependency org="com.webasyst" name="auth" rev="1.0.0">
  <artifact name="auth" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.webasyst', module='auth', version='1.0.0')
)
libraryDependencies += "com.webasyst" % "auth" % "1.0.0"
[com.webasyst/auth "1.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
net.openid : appauth jar 0.7.1

runtime (1)

Group / Artifact Type Version
androidx.appcompat » appcompat jar 1.2.0

Project Modules

There are no modules declared in this project.

Webasyst-X-Android-Library

Creating new Webasyst Android client app

Starting from template

There is an example application using this library. Feel free to fork it and modify to your needs.

Starting from scratch

  1. Add dependencies

In your application module

repositories {
    // Make sure maven central repository is enabled
    mavenCentral()
    // ...
}

dependencies {
    // Library version to use
    def webasyst_version = '1.0.0'
    // Authentication module. Used in log in process.
    implementation "com.webasyst:auth-kt:$webasyst_version"
    // Webasyst ID (WAID) api client
    implementation "com.webasyst:waid:$webasyst_version"
    // Webasyst client - used to retrieve basic installation data
    implementation "com.webasyst:webasyst:$webasyst_version"
    // Required application-specific modules
    implementation "com.webasyst:app-blog:$webasyst_version"
        implementation "com.webasyst:app-shop:$webasyst_version"
        implementation "com.webasyst:app-site:$webasyst_version"
}
  1. In your app's AndroidManifest.xml, in application section, add authentication redirect activity. Note the comment on <data android:scheme= key
<activity android:name="net.openid.appauth.RedirectUriReceiverActivity">
  <intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <!-- Authentication redirect scheme. It should be unique across the device. It's recommended to use app's package name. -->
    <data android:scheme="webasyst-x"/>
  </intent-filter>
</activity>
  1. Configure Webasyst ID (WAID) client. This should be done once, preferably early in application's lifecycle. The recommended option is to extend Application class and do configuration in it's onCreate() method. See WebasystAuthService.configure() for details.

  2. Implement Authentication Activity.

The easiest way to do it is to extend your Activity from WebasystAuthActivity and call it's waSignIn() from your SignIn button's onClick() callback.

If that's not an option (eg. your Activity is an extension of some other activity) you can use WebasystAuthHelper directly. See WebasystAuthActivity's code for details.

  1. You are good to go. Use WebasystAuthService's withFreshAccessToken() (or Kotlin extension) to perform api requests.
com.webasyst

1312 Inc.

Making amazing apps and digital products

Versions

Version
1.0.0