Coder Social home page Coder Social logo

cortinico / android-auth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spotify/android-auth

1.0 2.0 0.0 306 KB

Spotify authentication and authorization for Android. Part of the Spotify Android SDK.

Home Page: https://github.com/spotify/android-sdk

License: Apache License 2.0

Java 100.00%

android-auth's Introduction

Spotify Authentication Library

This repository is now a part of spotify/android-sdk. Please post new issues there!

This library is responsible for authenticating the user and fetching the access token that can subsequently be used to play music or in requests to the Spotify Web API.

Integrating the library into your project

To add this library to your project add the reference to its build.gradle file:

compile 'com.spotify.android:auth:1.2.3'

To learn more about working with authentication see the Authentication Guide and the API reference on the developer site.

The following entries are merged into your manifest when you add the library:

<uses-permission android:name="android.permission.INTERNET"/>

<activity
    android:exported="true"
    android:name="com.spotify.sdk.android.authentication.AuthCallbackActivity"
    android:theme="@android:style/Theme.Translucent.NoTitleBar">

    <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>

        <data
            android:scheme="@string/com_spotify_sdk_redirect_scheme"
            android:host="@string/com_spotify_sdk_redirect_host"/>
    </intent-filter>
</activity>

<activity
    android:name="com.spotify.sdk.android.authentication.LoginActivity"
    android:theme="@android:style/Theme.Translucent.NoTitleBar">
</activity>

You will need to add the following strings to your project to enable Chrome CustomTabs login flow:

<resources>
    <string name="com_spotify_sdk_redirect_scheme">yourscheme</string>
    <string name="com_spotify_sdk_redirect_host">yourhost</string>
</resources>

So, if you provided bestapp://ismyapp as a redirect URI in the developer console then you set com_spotify_sdk_redirect_scheme to bestapp and com_spotify_sdk_redirect_host to ismyapp.

Since Chrome CustomTabs share credentials with the Chrome instance you have installed you get much better experience logging users in compare to WebView flow.

Sample Code

Checkout the sample project.

Contributing

You are welcome to contribute to this project. Please make sure that:

  • New code is test covered
  • Features and APIs are well documented
  • ./gradlew check must succeed

Code of conduct

This project adheres to the Open Code of Conduct. By participating, you are expected to honor this code.

android-auth's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.