Skip to content

Commit

Permalink
Merge pull request #34 from smartcar/oauth-capture
Browse files Browse the repository at this point in the history
Add OAuth capture functionality
  • Loading branch information
ew534679 authored Sep 4, 2024
2 parents 027ff2e + ef9c9a7 commit aab0111
Show file tree
Hide file tree
Showing 14 changed files with 581 additions and 198 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: android
jdk: openjdk17

branches:
except:
Expand All @@ -7,13 +8,14 @@ branches:

env:
global:
- BUILD_TOOLS_VERSION=29.0.2
- ANDROID_API_LEVEL=29
- BUILD_TOOLS_VERSION=34.0.0
- ANDROID_API_LEVEL=34

android:
components:
- tools
- platform-tools
- cmdline-tools
- build-tools-$BUILD_TOOLS
- android-$ANDROID_API_LEVEL
- extra-google-google_play_services
Expand All @@ -28,6 +30,7 @@ android:
script:
# accept sdk licenses and build/test the project
- yes | sdkmanager --update
- yes | sdkmanager --licenses
- ./gradlew build check

# report coverage (disabled)
Expand Down
24 changes: 0 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,6 @@ dependencies {
}
```

## Redirect URI Setup

Your application must register a custom URI scheme in order to receive Connect's response. Smartcar requires the custom URI scheme to be in the format of `"sc" + clientId + "://" + hostname`. This URI must also be registered in [Smartcar's developer portal](https://dashboard.smartcar.com) for your application. You may append an optional path component or TLD. For example, a redirect uri could be:

```
sc4a1b01e5-0497-417c-a30e-6df6ba33ba46://myapp.com/callback
```

You will then need to register the URI in the `AndroidManifest.xml` by inserting a new activity with an intent filter. More information on the [data element](https://developer.android.com/guide/topics/manifest/data-element.html).

```xml
<activity android:name="com.smartcar.sdk.SmartcarCodeReceiver">
<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="sc4a1b01e5-0497-417c-a30e-6df6ba33ba46"
android:host="myapp.com"
android:path="/callback" />
</intent-filter>
</activity>
```

## Usage

1. Instantiate a new [`SmartcarAuth`](https://smartcar.github.io/android-sdk/com/smartcar/sdk/SmartcarAuth.html) instance with a [`SmartcarCallback`](https://smartcar.github.io/android-sdk/com/smartcar/sdk/SmartcarCallback.html) handler:
Expand Down
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
buildscript {
ext {
kotlin_version = '2.0.0'
}
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.android.tools.build:gradle:8.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit aab0111

Please sign in to comment.