Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Latest commit

 

History

History
38 lines (28 loc) · 1.36 KB

oauth_configuration.md

File metadata and controls

38 lines (28 loc) · 1.36 KB

OAuth2 configuration

If you're building the joind.in Android app, you'll need to set up the OAuth2 configuration.

It's best if you first set up the joind.in API locally - that way you can have full control over the client configuration.

The Android app uses the OAuth2 "Client Credentials Flow" method of authentication - this means that your client ID needs to be authorised by the API.

Configuring the API

In the API project, open up src/config.php and add an entry to the expirable_client_ids file:

$config =  array(
    'mode' => 'development',
    'oauth' => array(
        'expirable_client_ids' => array(
            // ...
            'androidapp',
        )
    ),
);

This will allow credentials access with a client ID of "androidapp".

You'll need to create an entry in the oauth_consumers API database table, with a consumer key of androidapp and a secret - eg androidappsecret. Set the enable_password_grant field to 1. The API is now ready to go.

Configuring the Android app

In the Android app project, you'll need to create a file called oauth.properties and place it in res/raw. The content should be:

client_id=androidapp
client_secret=androidappsecret

Once you've placed this in, authentication via the app's settings page should work when you build the app and point it to your local API.