Popularity
0.6
Stable
Activity
0.0
Stable
6
2
0

Description

The Github_OAuth library helps to easily add a GitHub's OAuth implementation flow to your Android application.It will open a new Dialog Fragment with webview and user token will be returned on callback.

Programming language: Kotlin

Github OAuth Client Library alternatives and similar packages

Based on the "Animations" category.
Alternatively, view Github OAuth Client Library alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Github OAuth Client Library or a related project?

Add another 'Animations' Package

README

Github OAuth Client Library - Android

The Github_OAuth library helps to easily add a GitHub's OAuth implementation flow to your Android application.It will open a new Dialog Fragment with webview and user token will be returned on callback.

Find more about GitHub's OAuth implementation

Setup

Include in your project

Using Gradle

The Github-OAuth library is pushed to jcenter, so you need to add the following dependency to your app's build.gradle.

dependencies {
  implementation 'com.github.rahul:github-oauth:1.0'
  implementation 'com.squareup.okhttp3:okhttp:3.8.0'
}

As a module

If you can't include it as gradle dependency, you can also download this GitHub repo and copy the library folder to your project.

Usage

Obtaining GithubAuthenticator instance

val githubAuthenticatorBuilder = GithubAuthenticator.builder(this)
                .clientId(GITHUB_ID)
                .clientSecret(GITHUB_SECRET)
                .onSuccess(object : SuccessCallback {
                    override fun onSuccess(result: String) {
                        runOnUiThread {
                            Toast.makeText(this@MainActivity, result,
                                    Toast.LENGTH_LONG).show()
                        }
                    }
                })
                .onError(object : ErrorCallback {
                    override fun onError(error: Exception) {
                        runOnUiThread {
                            Toast.makeText(this@MainActivity, error.message,
                                    Toast.LENGTH_LONG).show()
                        }
                    }
                })

val githubAuthenticator = githubAuthenticatorBuilder.build()

Obtaining an access token via the GithubAuthenticator

githubAuthenticator.authenticate()

Authenticate will open a new Dialog Fragment with webview and user token will be returned on callback

Enable logs

githubAuthenticatorBuilder.debug(true)

Scope can also be defined (optional)

githubAuthenticatorBuilder.scopeList(arrayListOf("scope1", "scope2"))

Available scopes are from developer page

License

Copyright 2018, Rahul M Mohan

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


*Note that all licence references and agreements mentioned in the Github OAuth Client Library README section above are relevant to that project's source code only.