https://github.com/oktadev/okta-android-rxjava-example
Android RxJava Example
https://github.com/oktadev/okta-android-rxjava-example
android kotlin oidc reactive reactivex rxjava
Last synced: 26 days ago
JSON representation
Android RxJava Example
- Host: GitHub
- URL: https://github.com/oktadev/okta-android-rxjava-example
- Owner: oktadev
- License: apache-2.0
- Created: 2021-05-18T20:39:07.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-05-26T18:21:20.000Z (about 5 years ago)
- Last Synced: 2025-01-14T11:42:50.772Z (over 1 year ago)
- Topics: android, kotlin, oidc, reactive, reactivex, rxjava
- Language: Kotlin
- Homepage: https://developer.okta.com/blog/2021/05/26/rxjava-android-with-kotlin
- Size: 687 KB
- Stars: 1
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RxJava Android example
This is an example Android app which demonstrates how to use RxJava framework to communicate with a Spring Boot app, which is secured by Okta and OAuth 2.0. Please read [Build an Android App with RxJava and Kotlin](https://developer.okta.com/blog/2021/05/26/rxjava-android-with-kotlin) to see how it was created.
**Prerequisites:**
* [Android Studio][android-studio]
* [Okta CLI][okta-cli]
> [Okta](https://developer.okta.com/) has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage and secure users and roles in any application.
* [Getting Started](#getting-started)
* [Links](#links)
* [Help](#help)
* [License](#license)
## Getting Started
Clone the Spring Boot web app:
```bash
git clone https://github.com/oktadev/okta-spring-webflux-react-example.git reactive-spring-boot
cd reactive-spring-boot/reactive-web
```
Use the Okta CLI to register with Okta and create your first application:
```bash
okta register # use `okta login` if you already have an account
okta apps create
```
Select **Web** and **Other** when prompted.
Copy your Okta values from `.okta.env` into the `reactive-spring-boot/reactive-web/src/main/resources/application.yml` file.
You can also use the instructions in [this](https://github.com/oktadev/okta-spring-webflux-react-example#getting-started) repo's getting started section.
Run the server by running the command:
```bash
./mvnw
```
Clone this example's source code:
```bash
git clone https://github.com/oktadev/okta-android-rxjava-example.git
cd okta-android-rxjava-example
```
Create another OIDC application:
```bash
okta apps create
```
Select **Native** and the default Redirect URIs. This will result in output like the following:
```bash
Okta application configuration:
okta.oauth2.issuer: https://dev-6974382.okta.com/oauth2/default
okta.oauth2.client-id: 0oa3dzttoa4qslD0T5d6
```
Modify the `app/src/main/java/dev/dbikic/oktaloginexample/OktaManager.kt` to use your settings:
```kotlin
init {
val config = OIDCConfig.Builder()
.clientId("{yourClientId}")
.discoveryUri("https://{yourOktaDomain}/oauth2/default")
.redirectUri("{yourReverseOktaDomain}:/callback")
.endSessionRedirectUri("{yourReverseOktaDomain}:/")
.scopes("openid", "profile", "offline_access")
.create()
...
}
```
You'll also need to update `app/build.gradle` to use your reverse domain name.
```groovy
manifestPlaceholders = [
"appAuthRedirectScheme": "{yourReverseOktaDomain}"
]
```
Press the play icon in the top right part of Android Studio. You should be able to log in with your Okta credentials and create/update/delete posts.
## Links
This example uses the following open source libraries from Okta:
* [Okta Android SDK](https://github.com/okta/okta-oidc-android)
* [Okta CLI](https://github.com/okta/okta-cli)
## Help
Please post any questions as comments on [this example's blog post][blog], or use our [Okta Developer Forums](https://devforum.okta.com/).
## License
Apache 2.0, see [LICENSE](LICENSE).
[android-studio]: https://developer.android.com/studio
[blog]: https://developer.okta.com/blog/2021/05/26/rxjava-android-with-kotlin
[okta-cli]: https://github.com/okta/okta-cli