Github OAuth - Easily add a GitHub's OAuth implementation flow to your Android application

Related tags

UI/UX Github_OAuth
Overview

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.
You might also like...
Material Design tap target for Android. https://sjwall.github.io/MaterialTapTargetPrompt/
Material Design tap target for Android. https://sjwall.github.io/MaterialTapTargetPrompt/

Material Tap Target Prompt A Tap Target implementation in Android based on Material Design Onboarding guidelines. For more information on tap targets

Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Carbon Material Design implementation for Android 4.0 and newer. This is not the exact copy of the Lollipop's API and features. It's a custom implemen

AndroidTreeView. TreeView implementation for android
AndroidTreeView. TreeView implementation for android

AndroidTreeView Recent changes 2D scrolling mode added, keep in mind this comes with few limitations: you won't be able not place views on right side

Proof of concept Android WebView implementation based on Chromium code

Deprecation Notice This project is un-maintained. The recommended alternative is the Crosswalk Project. I did not have the time to keep the project up

Wizard Pager is a library that provides an example implementation of a Wizard UI on Android
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android

Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager.

Fully customizable implementation of
Fully customizable implementation of "Snowfall View" on Android.

Android-Snowfall Fully customizable implementation of "Snowfall View" on Android. That's how we use it in our app Hotellook Compatibility This library

Owner
Rahul M Mohan
I am an empathetic and curious Mobile Engineer. I have a pragmatic view on development and see it as a tool to express myself and build products.
Rahul M Mohan
A simple library to add Emoji support to your Android Application

Emoji A library to add Emoji support to your Android app. Emojis can be picked in a PopupWindow. In order to edit and display text with Emojis this li

Niklas Baudy 1.4k Jan 4, 2023
Add some depth to your Android scrolling.

Parallax Pager Add some depth to your Android scrolling using the parallax effect! Installation Step 1. Add the JitPack repository to your build file

Prolific Interactive 782 Dec 29, 2022
StandOut lets you easily create floating windows in your Android app.

Coming Soon Meanwhile, checkout the demo video at http://www.youtube.com/watch?v=S3vHjxonOeg Join the conversation at http://forum.xda-developers.com/

Mark Wei 1.2k Dec 12, 2022
This library offers a simple method to add a small badge icon to your ActionBar-MenuItem

Android-ActionItemBadge ActionItemBadge is a library which offers a simple and easy to use method to add a badge to your action item! Screenshots Incl

Mike Penz 1.3k Jan 1, 2023
Step by step,just use HorizontalStepView,VerticalStepView. step indicator,flow indicator,timeline,order process,express status

StepView Step by step. Step indicator. Flow indicator。 snapshot like this:HorizontalStepView like this also like this:VerticalStepView Yeah,I am not w

baoyachi. Aka Rust Hairy crabs 4.1k Dec 30, 2022
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
Android view that allows the user to create drawings. Customize settings like color, width or tools. Undo or redo actions. Zoom into DrawView and add a background.

DrawView Android view that allows the user to create drawings. Draw anything you like in your Android device from simple view. Customize draw settings

Oscar Gilberto Medina Cruz 839 Dec 28, 2022
Easily create complex recyclerview adapters in android

?? Due to the nature of my job and growing popularity of Jetpack Compose, I lack the motivation to keep this project alive. Recyclerview is one of the

Riyaz Ahamed 823 Jan 6, 2023
Android library to create chat message view easily

ChatMessageView ChatMessageView helps you to create chat message view quickly like a typical chatting application. Its a container view, so you can ad

Himanshu Soni 641 Dec 24, 2022
PCard Add payment card screen made using JetPack Compose

PCard Add payment card screen made using JetPack Compose Find this repository useful? ❤️ Support it by joining stargazers for this repository. ⭐ And f

Mohamed Elbehiry 61 Dec 16, 2022