From 8463d218b0cce37476aa5a4a2304d75ab80cdba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:49:37 -0300 Subject: [PATCH 01/14] :technologist: Adding default values to `` and `` components to avoid having to type them everytime --- astro/src/diagrams/quickstarts/login-after.astro | 2 +- astro/src/diagrams/quickstarts/login-before.astro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/astro/src/diagrams/quickstarts/login-after.astro b/astro/src/diagrams/quickstarts/login-after.astro index 761ef67c96..b7ef39880c 100644 --- a/astro/src/diagrams/quickstarts/login-after.astro +++ b/astro/src/diagrams/quickstarts/login-after.astro @@ -1,6 +1,6 @@ --- import Diagram from "../../components/mermaid/Diagram.astro"; -const { alt } = Astro.props; +const { alt = "Request flow during login after FusionAuth" } = Astro.props; //language=Mermaid const diagram = ` diff --git a/astro/src/diagrams/quickstarts/login-before.astro b/astro/src/diagrams/quickstarts/login-before.astro index e35bd4ccf6..5ec606a6a1 100644 --- a/astro/src/diagrams/quickstarts/login-before.astro +++ b/astro/src/diagrams/quickstarts/login-before.astro @@ -1,6 +1,6 @@ --- import Diagram from "../../components/mermaid/Diagram.astro"; -const { alt } = Astro.props; +const { alt = "Request flow during login before FusionAuth" } = Astro.props; //language=Mermaid const diagram = ` From be6d1c808b1e7113a72bb767e07d53182e72d815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:49:48 -0300 Subject: [PATCH 02/14] :construction: Android Java Quickstart: starting to create it --- .../quickstarts/quickstart-android-java.mdx | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 astro/src/content/quickstarts/quickstart-android-java.mdx diff --git a/astro/src/content/quickstarts/quickstart-android-java.mdx b/astro/src/content/quickstarts/quickstart-android-java.mdx new file mode 100644 index 0000000000..ca9fc55750 --- /dev/null +++ b/astro/src/content/quickstarts/quickstart-android-java.mdx @@ -0,0 +1,98 @@ +--- +title: Android +description: Quickstart integration of Java-based Android app with FusionAuth +navcategory: getting-started +prerequisites: Android Studio, Git +section: native +technology: Android +language: Java +icon: /img/icons/android.svg +faIcon: fa-android +color: indigo +coderoot: https://raw.githubusercontent.com/FusionAuth/fusionauth-example-android-java/main +cta: EmailListCTA +--- +import Aside from '../../components/Aside.astro'; +import LoginAfter from '../../diagrams/quickstarts/login-after.astro'; +import LoginBefore from '../../diagrams/quickstarts/login-before.astro'; +import RemoteCode from '../../components/RemoteCode.astro'; + +In this quickstart you are going to build an Android app and integrate it with FusionAuth. +You'll be building it for [ChangeBank](https://www.youtube.com/watch?v=pkH-kD73QUM), a global leader in converting dollars into coins. +It'll have areas reserved for users who have logged in as well as public facing sections. + +The docker compose file and source code for a complete application are available at +https://github.com/FusionAuth/fusionauth-example-android-java + +## Prerequisites + +- [Android Studio](https://developer.android.com/studio): The official IDE for Android will help you develop and install necessary tools to set it up. +- [Git](https://git-scm.com/site): You'll use to clone the base repository. +- [Docker](https://www.docker.com): The quickest way to stand up FusionAuth. (There are [other ways](https://fusionauth.io/docs/v1/tech/installation-guide/)). + +This app was built on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android/), which is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers, and it supports Android API 16 (Jellybean) and above. + +## General Architecture + +While this sample application doesn't have login functionality without FusionAuth, a more typical integration will replace an existing login system with FusionAuth. + +In that case, the system might look like this before FusionAuth is introduced. + + + +The login flow will look like this after FusionAuth is introduced. + + + +In general, you are introducing FusionAuth in order to normalize and consolidate user data. This helps make sure it is consistent and up-to-date as well as offloading your login security and functionality to FusionAuth. + +## Getting Started + +In this section, you'll get FusionAuth up and running and use `git` to create a new application. + +### Clone the Code + +First off, grab the code from the repository and change into that directory. + +```shell +git clone https://github.com/FusionAuth/fusionauth-example-android-java.git +cd fusionauth-example-android-java +``` + +### Run FusionAuth via Docker + +In the root directory of the repo you'll find a Docker compose file (`docker-compose.yml`) and an environment variables configuration file (`.env`). Assuming you have Docker installed on your machine, you can stand up FusionAuth up on your machine with: + +``` +docker compose up -d +``` + +Here you are using a bootstrapping feature of FusionAuth, called [Kickstart](https://fusionauth.io/docs/v1/tech/installation-guide/kickstart). When FusionAuth comes up for the first time, it will look at the `kickstart/kickstart.json` file and configure FusionAuth to a certain initial state. + + + +FusionAuth will be initially configured with these settings: + +* Your client Id is `e9fdb985-9173-4e01-9d73-ac2d60d1dc8e`. +* Your client secret is `super-secret-secret-that-should-be-regenerated-for-production`. +* Your example username is `richard@example.com` and the password is `password`. +* Your admin username is `admin@example.com` and the password is `password`. +* The base URL of FusionAuth `http://localhost:9011/`. + +You can log into the [FusionAuth admin UI](http://localhost:9011/admin) and look around if you want, but with Docker/Kickstart you don't need to. + +### Create your Android App + +Now you are going to create an Android app. While this section builds a simple Android app on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android/), you can use the same configuration to integrate your existing app with FusionAuth. + +```shell +git clone https://github.com/FusionAuth/openid-AppAuth-Android.git +cd openid-AppAuth-Android +``` + +### Configure AppAuth + +You'll have to change some files to integrate FusionAuth into your app. + From fd544e1d4567d05b21f52a958f8b868fb6139a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Wed, 2 Aug 2023 09:50:07 -0300 Subject: [PATCH 03/14] :children_crossing: Adding missing title to the Quickstarts page --- astro/src/pages/docs/quickstarts/index.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astro/src/pages/docs/quickstarts/index.astro b/astro/src/pages/docs/quickstarts/index.astro index 851f3ba8ec..a507fed35e 100644 --- a/astro/src/pages/docs/quickstarts/index.astro +++ b/astro/src/pages/docs/quickstarts/index.astro @@ -4,7 +4,7 @@ import Section from "../../../components/quickstarts/QuickstartSection.astro" import { quickstartSections } from './quickstart-sections'; --- - +
From ba5164224584c3f3f86e18f50de36933184a736b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Tue, 8 Aug 2023 09:30:08 -0300 Subject: [PATCH 04/14] :memo: Continuing to write Android app quickstart --- .../quickstarts/quickstart-android-java.mdx | 128 ++++++++++++++++-- 1 file changed, 118 insertions(+), 10 deletions(-) diff --git a/astro/src/content/quickstarts/quickstart-android-java.mdx b/astro/src/content/quickstarts/quickstart-android-java.mdx index ca9fc55750..018198e6c1 100644 --- a/astro/src/content/quickstarts/quickstart-android-java.mdx +++ b/astro/src/content/quickstarts/quickstart-android-java.mdx @@ -1,6 +1,6 @@ --- -title: Android -description: Quickstart integration of Java-based Android app with FusionAuth +title: Java for Android +description: Quickstart integration of a Java-based Android app with FusionAuth navcategory: getting-started prerequisites: Android Studio, Git section: native @@ -9,7 +9,6 @@ language: Java icon: /img/icons/android.svg faIcon: fa-android color: indigo -coderoot: https://raw.githubusercontent.com/FusionAuth/fusionauth-example-android-java/main cta: EmailListCTA --- import Aside from '../../components/Aside.astro'; @@ -22,15 +21,15 @@ You'll be building it for [ChangeBank](https://www.youtube.com/watch?v=pkH-kD73Q It'll have areas reserved for users who have logged in as well as public facing sections. The docker compose file and source code for a complete application are available at -https://github.com/FusionAuth/fusionauth-example-android-java +https://github.com/FusionAuth/fusionauth-quickstart-android-java ## Prerequisites - [Android Studio](https://developer.android.com/studio): The official IDE for Android will help you develop and install necessary tools to set it up. -- [Git](https://git-scm.com/site): You'll use to clone the base repository. +- [Git](https://git-scm.com/site): You'll use it to clone the base repository. - [Docker](https://www.docker.com): The quickest way to stand up FusionAuth. (There are [other ways](https://fusionauth.io/docs/v1/tech/installation-guide/)). -This app was built on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android/), which is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers, and it supports Android API 16 (Jellybean) and above. +This app was built on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android), which is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers, and it supports Android API 16 (Jellybean) and above. ## General Architecture @@ -55,8 +54,8 @@ In this section, you'll get FusionAuth up and running and use `git` to create a First off, grab the code from the repository and change into that directory. ```shell -git clone https://github.com/FusionAuth/fusionauth-example-android-java.git -cd fusionauth-example-android-java +git clone https://github.com/FusionAuth/fusionauth-quickstart-android-java.git +cd fusionauth-quickstart-android-java ``` ### Run FusionAuth via Docker @@ -83,16 +82,125 @@ FusionAuth will be initially configured with these settings: You can log into the [FusionAuth admin UI](http://localhost:9011/admin) and look around if you want, but with Docker/Kickstart you don't need to. +### Expose FusionAuth Instance + +To make sure your local FusionAuth instance is accessible to your Android app, you need to [expose it to the Internet](/docs/v1/tech/developer-guide/exposing-instance). Write down the URL ngrok gave you as you'll need it soon. + ### Create your Android App -Now you are going to create an Android app. While this section builds a simple Android app on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android/), you can use the same configuration to integrate your existing app with FusionAuth. +Now you are going to create an Android app. While this section builds a simple Android app on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android), you can use the same configuration to integrate your existing app with FusionAuth. ```shell git clone https://github.com/FusionAuth/openid-AppAuth-Android.git cd openid-AppAuth-Android ``` +Start by adjusting the package namespace in `app/build.gradle`: + + + +Let `app/AndroidManifest.xml` know the namespace change as well. + + + +## Authentication + +We'll use the [AppAuth Library](https://github.com/openid/AppAuth-Android), which simplifies integrating with FusionAuth and creating a secure web application. + ### Configure AppAuth -You'll have to change some files to integrate FusionAuth into your app. +Modify `app/res/raw/auth_config.json` to use the values provisioned by Kickstart. In `discovery_uri`, change `https://[YOUR-NGROK-MAIN-DOMAIN]` to the URL you wrote when [exposing your instance](#expose-fusionauth-instance). + + + +### Change Activities + +An [Activity](https://developer.android.com/guide/components/activities/intro-activities) is basically a screen for your app, combining the User Interface and the logic to handle it. + +Start changing the login activity layout at `app/res/drawable/layout/activity_login.xml`: + + + +Now modify its logic at `app/java/io/fusionauth/app/LoginActivity.java`: + + + +Edit the main screen layout at `app/res/drawable/layout/activity_token.xml`: + + + +And finally, change the main screen logic at `app/java/io/fusionauth/app/TokenActivity.java`: + + + +## App Customization + +In this section, you'll turn your application into a trivial banking application with some styling. + +### Change Colors and Strings + +Change the app colors in `app/res/values/colors.xml` to the ones used by Changebank. + + + +Modify the strings that will be shown in the interface at `app/res/values/strings.xml`. + + + +### Add Styling + +Now, add some image assets to make this look like a real application with the following shell commands: + +```shell +curl -o app/res/drawable/changebank.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/drawable/changebank.png +curl -o app/res/mipmap-hdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-hdpi/ic_launcher.png +curl -o app/res/mipmap-hdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-hdpi/ic_launcher.png +curl -o app/res/mipmap-mdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-mdpi/ic_launcher.png +curl -o app/res/mipmap-xhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-xhdpi/ic_launcher.png +curl -o app/res/mipmap-xxhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-xxhdpi/ic_launcher.png +curl -o app/res/mipmap-xxxhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-xxxhdpi/ic_launcher.png +``` + +Once you've created these files, you can test the application out. + +## Run the App + +You can either [connect a hardware device](https://developer.android.com/studio/run/device) or create an Android Virtual Device to run the [Android Emulator](https://developer.android.com/studio/run/emulator) + +[Build and run the app](https://developer.android.com/studio/run/) following Android Studio guidelines. + +## Next Steps + +This quickstart is a great way to get a proof of concept up and running quickly, but to run your application in production, there are some things you're going to want to do. + +### FusionAuth Customization + +FusionAuth gives you the ability to customize just about everything with the user's experience and your application's integration. This includes +* [Hosted pages](https://fusionauth.io/docs/v1/tech/themes/) such as login, registration, email verification, and many more +* [Email templates](https://fusionauth.io/docs/v1/tech/email-templates/email-templates) +* [User data and custom claims in access token JWTs](https://fusionauth.io/articles/tokens/jwt-components-explained) + +### Security +* Implement refresh tokens using [AppAuth](https://github.com/openid/AppAuth-Android) +* You may want to customize the [token expiration times and policies](https://fusionauth.io/docs/v1/tech/oauth/#configure-application-oauth-settings) in FusionAuth +* Choose [password rules](https://fusionauth.io/docs/v1/tech/core-concepts/tenants#password) and a [hashing algorithm](https://fusionauth.io/docs/v1/tech/reference/password-hashes) that meet your security needs + +### Tenant and Application Management +* Model your application topology using [Applications](https://fusionauth.io/docs/v1/tech/core-concepts/applications), [Roles](https://fusionauth.io/docs/v1/tech/core-concepts/roles), [Groups](https://fusionauth.io/docs/v1/tech/core-concepts/groups), [Entities](https://fusionauth.io/docs/v1/tech/core-concepts/groups), and more +* Set up [MFA](https://fusionauth.io/docs/v1/tech/guides/multi-factor-authentication), [Social login](https://fusionauth.io/docs/v1/tech/identity-providers/), and/or [SAML](https://fusionauth.io/docs/v1/tech/identity-providers/samlv2/) integrations +* Integrate with external systems using [Webhooks](https://fusionauth.io/docs/v1/tech/events-webhooks/), [SCIM](https://fusionauth.io/docs/v1/tech/core-concepts/scim), and [Lambdas](https://fusionauth.io/docs/v1/tech/lambdas/) + +## Troubleshooting + +* I can't log in +Make sure you have the right values at `app/res/raw/auth_config.json`. If you didn't use Kickstart to set up your FusionAuth instance, double-check the `Issuer` in the **Tenant**. From 7d6e21f735b3ea7f9ca9ba4838fcdb205183bb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Tue, 8 Aug 2023 09:31:46 -0300 Subject: [PATCH 05/14] :pencil2: Fixing typo in quickstarts --- astro/src/content/quickstarts/quickstart-golang-web.mdx | 2 +- astro/src/content/quickstarts/quickstart-python-flask-web.mdx | 2 +- astro/src/content/quickstarts/quickstart-ruby-rails-web.mdx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/astro/src/content/quickstarts/quickstart-golang-web.mdx b/astro/src/content/quickstarts/quickstart-golang-web.mdx index b093e43f13..dde41123f9 100644 --- a/astro/src/content/quickstarts/quickstart-golang-web.mdx +++ b/astro/src/content/quickstarts/quickstart-golang-web.mdx @@ -260,7 +260,7 @@ Click the `Logout` button and watch the browser first go to FusionAuth to log ou ## Next Steps This quickstart is a great way to get a proof of concept up and running quickly, but to run -you application in production, there are some things you're going to want to do. +your application in production, there are some things you're going to want to do. ### FusionAuth Customization FusionAuth gives you the ability to customize just about everything with the user's experience and your application's integration. This includes diff --git a/astro/src/content/quickstarts/quickstart-python-flask-web.mdx b/astro/src/content/quickstarts/quickstart-python-flask-web.mdx index d3d5233d9c..c0493b7c29 100644 --- a/astro/src/content/quickstarts/quickstart-python-flask-web.mdx +++ b/astro/src/content/quickstarts/quickstart-python-flask-web.mdx @@ -226,7 +226,7 @@ Click the `Logout` button and watch the browser first go to FusionAuth to log ou ## Next Steps This quickstart is a great way to get a proof of concept up and running quickly, but to run -you application in production, there are some things you're going to want to do. +your application in production, there are some things you're going to want to do. ### FusionAuth Customization FusionAuth gives you the ability to customize just about everything with the user's experience and your application's integration. This includes diff --git a/astro/src/content/quickstarts/quickstart-ruby-rails-web.mdx b/astro/src/content/quickstarts/quickstart-ruby-rails-web.mdx index a2c52eb7a1..6c2beca629 100644 --- a/astro/src/content/quickstarts/quickstart-ruby-rails-web.mdx +++ b/astro/src/content/quickstarts/quickstart-ruby-rails-web.mdx @@ -230,7 +230,7 @@ You can now open up an incognito window and visit the Rails app at http://localh ## Next Steps This quickstart is a great way to get a proof of concept up and running quickly, but to run -you application in production, there are some things you're going to want to do. +your application in production, there are some things you're going to want to do. ### FusionAuth Customization FusionAuth gives you the ability to customize just about everything with the user's experience and your application's integration. This includes From e3aa142320871f0fdb7976f39efc7ab939fbe7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Fri, 11 Aug 2023 09:24:57 -0300 Subject: [PATCH 06/14] :alien: refs #2415 Android Java: Renaming quickstart and repo --- .../quickstarts/quickstart-android-java.mdx | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/astro/src/content/quickstarts/quickstart-android-java.mdx b/astro/src/content/quickstarts/quickstart-android-java.mdx index 018198e6c1..9a608f63f7 100644 --- a/astro/src/content/quickstarts/quickstart-android-java.mdx +++ b/astro/src/content/quickstarts/quickstart-android-java.mdx @@ -1,5 +1,5 @@ --- -title: Java for Android +title: Android Java description: Quickstart integration of a Java-based Android app with FusionAuth navcategory: getting-started prerequisites: Android Studio, Git @@ -16,12 +16,12 @@ import LoginAfter from '../../diagrams/quickstarts/login-after.astro'; import LoginBefore from '../../diagrams/quickstarts/login-before.astro'; import RemoteCode from '../../components/RemoteCode.astro'; -In this quickstart you are going to build an Android app and integrate it with FusionAuth. +In this quickstart you are going to build an Android app with Java and integrate it with FusionAuth. You'll be building it for [ChangeBank](https://www.youtube.com/watch?v=pkH-kD73QUM), a global leader in converting dollars into coins. It'll have areas reserved for users who have logged in as well as public facing sections. The docker compose file and source code for a complete application are available at -https://github.com/FusionAuth/fusionauth-quickstart-android-java +https://github.com/FusionAuth/fusionauth-quickstart-java-android-native ## Prerequisites @@ -54,8 +54,8 @@ In this section, you'll get FusionAuth up and running and use `git` to create a First off, grab the code from the repository and change into that directory. ```shell -git clone https://github.com/FusionAuth/fusionauth-quickstart-android-java.git -cd fusionauth-quickstart-android-java +git clone https://github.com/FusionAuth/fusionauth-quickstart-java-android-native.git +cd fusionauth-quickstart-java-android-native ``` ### Run FusionAuth via Docker @@ -97,12 +97,12 @@ cd openid-AppAuth-Android Start by adjusting the package namespace in `app/build.gradle`: - Let `app/AndroidManifest.xml` know the namespace change as well. - ## Authentication @@ -113,7 +113,7 @@ We'll use the [AppAuth Library](https://github.com/openid/AppAuth-Android), whic Modify `app/res/raw/auth_config.json` to use the values provisioned by Kickstart. In `discovery_uri`, change `https://[YOUR-NGROK-MAIN-DOMAIN]` to the URL you wrote when [exposing your instance](#expose-fusionauth-instance). - ### Change Activities @@ -122,22 +122,22 @@ An [Activity](https://developer.android.com/guide/components/activities/intro-ac Start changing the login activity layout at `app/res/drawable/layout/activity_login.xml`: - Now modify its logic at `app/java/io/fusionauth/app/LoginActivity.java`: - Edit the main screen layout at `app/res/drawable/layout/activity_token.xml`: - And finally, change the main screen logic at `app/java/io/fusionauth/app/TokenActivity.java`: - ## App Customization @@ -148,12 +148,12 @@ In this section, you'll turn your application into a trivial banking application Change the app colors in `app/res/values/colors.xml` to the ones used by Changebank. - Modify the strings that will be shown in the interface at `app/res/values/strings.xml`. - ### Add Styling @@ -161,13 +161,13 @@ Modify the strings that will be shown in the interface at `app/res/values/string Now, add some image assets to make this look like a real application with the following shell commands: ```shell -curl -o app/res/drawable/changebank.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/drawable/changebank.png -curl -o app/res/mipmap-hdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-hdpi/ic_launcher.png -curl -o app/res/mipmap-hdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-hdpi/ic_launcher.png -curl -o app/res/mipmap-mdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-mdpi/ic_launcher.png -curl -o app/res/mipmap-xhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-xhdpi/ic_launcher.png -curl -o app/res/mipmap-xxhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-xxhdpi/ic_launcher.png -curl -o app/res/mipmap-xxxhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-android-java/main/complete-application/app/res/mipmap-xxxhdpi/ic_launcher.png +curl -o app/res/drawable/changebank.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-java-android-native/main/complete-application/app/res/drawable/changebank.png +curl -o app/res/mipmap-hdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-java-android-native/main/complete-application/app/res/mipmap-hdpi/ic_launcher.png +curl -o app/res/mipmap-hdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-java-android-native/main/complete-application/app/res/mipmap-hdpi/ic_launcher.png +curl -o app/res/mipmap-mdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-java-android-native/main/complete-application/app/res/mipmap-mdpi/ic_launcher.png +curl -o app/res/mipmap-xhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-java-android-native/main/complete-application/app/res/mipmap-xhdpi/ic_launcher.png +curl -o app/res/mipmap-xxhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-java-android-native/main/complete-application/app/res/mipmap-xxhdpi/ic_launcher.png +curl -o app/res/mipmap-xxxhdpi/ic_launcher.png https://raw.githubusercontent.com/FusionAuth/fusionauth-quickstart-java-android-native/main/complete-application/app/res/mipmap-xxxhdpi/ic_launcher.png ``` Once you've created these files, you can test the application out. From b25c7dc5bb5a00d9b257f71782b7cd12186b04a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:56:23 -0300 Subject: [PATCH 07/14] :memo: refs #2415 Adding instructions on how to edit the Tenant issuer and regenerate keys --- .../content/quickstarts/quickstart-android-java.mdx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/astro/src/content/quickstarts/quickstart-android-java.mdx b/astro/src/content/quickstarts/quickstart-android-java.mdx index 9a608f63f7..53f73e3d32 100644 --- a/astro/src/content/quickstarts/quickstart-android-java.mdx +++ b/astro/src/content/quickstarts/quickstart-android-java.mdx @@ -14,6 +14,7 @@ cta: EmailListCTA import Aside from '../../components/Aside.astro'; import LoginAfter from '../../diagrams/quickstarts/login-after.astro'; import LoginBefore from '../../diagrams/quickstarts/login-before.astro'; +import IconButton from '../../components/IconButton.astro'; import RemoteCode from '../../components/RemoteCode.astro'; In this quickstart you are going to build an Android app with Java and integrate it with FusionAuth. @@ -80,12 +81,18 @@ FusionAuth will be initially configured with these settings: * Your admin username is `admin@example.com` and the password is `password`. * The base URL of FusionAuth `http://localhost:9011/`. -You can log into the [FusionAuth admin UI](http://localhost:9011/admin) and look around if you want, but with Docker/Kickstart you don't need to. - ### Expose FusionAuth Instance To make sure your local FusionAuth instance is accessible to your Android app, you need to [expose it to the Internet](/docs/v1/tech/developer-guide/exposing-instance). Write down the URL ngrok gave you as you'll need it soon. +### Configure FusionAuth Instance + +Now that you have [exposed your instance](#expose-fusionauth-instance), you need to update the Tenant issuer to make sure it matches the given address. + +Log into the [FusionAuth admin UI](http://localhost:9011/admin), browse to `Tenants` in the sidebar, click on the **Default** tenant to edit it. Paste the complete address _(with protocol and domain)_ you copied from ngrok into the `Issuer` field (e.g. `https://6d1e-2804-431-c7c9-739-4703-98a7-4b81-5ba6.ngrok-free.app`). Save the application by clicking the icon in the top right corner. + +Navigate to `Applications` and click on the **Example Android App** application. Click on the `JWT` tab, change both `Access token signing key` and `Id token signing key` to `Auto generate a new key on save...` and save the application. + ### Create your Android App Now you are going to create an Android app. While this section builds a simple Android app on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android), you can use the same configuration to integrate your existing app with FusionAuth. From b54b08c7641f2a11a3f5356bb93db6220f71789c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Mon, 14 Aug 2023 12:57:07 -0300 Subject: [PATCH 08/14] :technologist: Creating a `` component to render instance buttons with icons --- DocsDevREADME.md | 31 ++++----------- astro/src/components/IconButton.astro | 57 +++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 23 deletions(-) create mode 100644 astro/src/components/IconButton.astro diff --git a/DocsDevREADME.md b/DocsDevREADME.md index 4042874bce..fd1a60810e 100644 --- a/DocsDevREADME.md +++ b/DocsDevREADME.md @@ -42,31 +42,16 @@ Here are some guidelines to follow when writing documentation (everything under ``` egrep '^[=]+ ' site/docs/v1/tech/doc.adoc |sed 's/=//' |sed 's/=/*/g'|sed 's/* /* <>/' ``` -- We currently use [FontAwesome v5](https://fontawesome.com/v5/search?m=free) to render icons, so you can use them to refer to UI buttons, like this: - - In Markdown: - ```markdown - {:.ui-button .green .fa .fa-plus} - {:.ui-button .green .fa .fa-search} - {:.ui-button .blue .fa .fa-edit} - {:.ui-button .blue .fa .fa-save} - {:.ui-button .purple .fas .fa-user} - {:.ui-button .purple .fa .fa-key} - {:.ui-button .gray .fa .fa-minus-circle} - {:.ui-button .red .fa .fa-trash-alt} - ``` - - In AsciiDoc: - ```asciidoc - icon:plus[role=ui-button green,type=fas] - icon:search[role=ui-button green,type=fas] - icon:edit[role=ui-button blue,type=fas] - icon:save[role=ui-button blue,type=fas] - icon:user[role=ui-button purple,type=fas] - icon:key[role=ui-button purple,type=fa] - icon:minus-circle[role=ui-button gray,type=fa] - icon:trash-alt[role=ui-button red,type=fa] +- We currently use [FontAwesome v6](https://fontawesome.com/) to render icons, so you can use them to refer to UI buttons, like this: + ```jsx + + + + + ``` - ![icons](https://github.com/FusionAuth/fusionauth-site/assets/1877191/9fd29e3d-c81a-498c-9b82-135f44a7c545) + ![icons](https://github.com/FusionAuth/fusionauth-site/assets/1877191/719bffe8-2a54-41a2-a339-b3afeda8d499) ### Including files diff --git a/astro/src/components/IconButton.astro b/astro/src/components/IconButton.astro new file mode 100644 index 0000000000..bdaa4d98e5 --- /dev/null +++ b/astro/src/components/IconButton.astro @@ -0,0 +1,57 @@ +--- +interface Props { + icon: string; + color?: 'blue' | 'green' | 'red' | 'gray' | 'purple'; +} + +const {icon, color = 'blue'} = Astro.props; + +let className = 'fa-' + String(icon).replaceAll(' ', '-'); +switch (color) { + case 'blue': + case 'green': + case 'red': + case 'gray': + case 'purple': + className += ' btn-icon-' + color; + break; +} +--- + + + From 58b4f5fb3684f40959b65c9b184ac3857acab953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Mon, 14 Aug 2023 14:30:29 -0300 Subject: [PATCH 09/14] :lipstick: Fixing IconButton CSS due to some Tailwind warning --- astro/src/components/IconButton.astro | 47 +++++++++++++-------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/astro/src/components/IconButton.astro b/astro/src/components/IconButton.astro index bdaa4d98e5..96f8510bde 100644 --- a/astro/src/components/IconButton.astro +++ b/astro/src/components/IconButton.astro @@ -29,29 +29,28 @@ switch (color) { border-radius: 3px; background-color: var(--color); border: 1px solid var(--color); - - &:after { - color: #fff; - opacity: 1; - } - &.btn-icon-blue { - --color: #3998db; - } - &.btn-icon-green { - --color: #0bb796; - } - &.btn-icon-red { - --color: #ee3e54; - } - &.btn-icon-purple { - --color: #34485e; - } - &.btn-icon-gray { - border-color: #bfbfbf; - --color: #f7f7f7; - &:after { - color: #262626; - } - } + } + .btn-icon:after { + color: #fff; + opacity: 1; + } + .btn-icon.btn-icon-blue { + --color: #3998db; + } + .btn-icon.btn-icon-green { + --color: #0bb796; + } + .btn-icon.btn-icon-red { + --color: #ee3e54; + } + .btn-icon.btn-icon-purple { + --color: #34485e; + } + .btn-icon.btn-icon-gray { + border-color: #bfbfbf; + --color: #f7f7f7; + } + .btn-icon.btn-icon-gray:after { + color: #262626; } From 981a446e464af4d0ec7a08da1d359b2d6c909c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:10:45 -0300 Subject: [PATCH 10/14] :memo: refs #2415 Minor updates to the Android quickstart after initial review --- .../quickstarts/quickstart-android-java.mdx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/astro/src/content/quickstarts/quickstart-android-java.mdx b/astro/src/content/quickstarts/quickstart-android-java.mdx index 53f73e3d32..6ce4257c2e 100644 --- a/astro/src/content/quickstarts/quickstart-android-java.mdx +++ b/astro/src/content/quickstarts/quickstart-android-java.mdx @@ -27,6 +27,7 @@ https://github.com/FusionAuth/fusionauth-quickstart-java-android-native ## Prerequisites - [Android Studio](https://developer.android.com/studio): The official IDE for Android will help you develop and install necessary tools to set it up. + - There, you need to [install at least JDK 17](https://developer.android.com/build/jdks). - [Git](https://git-scm.com/site): You'll use it to clone the base repository. - [Docker](https://www.docker.com): The quickest way to stand up FusionAuth. (There are [other ways](https://fusionauth.io/docs/v1/tech/installation-guide/)). @@ -102,7 +103,14 @@ git clone https://github.com/FusionAuth/openid-AppAuth-Android.git cd openid-AppAuth-Android ``` -Start by adjusting the package namespace in `app/build.gradle`: +Start by removing some unused files: + +```shell +rm app/java/io/fusionauth/app/BrowserSelectionAdapter.java +rm app/res/layout/browser_selector_layout.xml +``` + +Change the package namespace in `app/build.gradle`: @@ -127,9 +135,9 @@ Modify `app/res/raw/auth_config.json` to use the values provisioned by Kickstart An [Activity](https://developer.android.com/guide/components/activities/intro-activities) is basically a screen for your app, combining the User Interface and the logic to handle it. -Start changing the login activity layout at `app/res/drawable/layout/activity_login.xml`: +Start changing the login activity layout at `app/res/layout/activity_login.xml`: - Now modify its logic at `app/java/io/fusionauth/app/LoginActivity.java`: @@ -137,9 +145,9 @@ Now modify its logic at `app/java/io/fusionauth/app/LoginActivity.java`: -Edit the main screen layout at `app/res/drawable/layout/activity_token.xml`: +Edit the main screen layout at `app/res/layout/activity_token.xml`: - And finally, change the main screen logic at `app/java/io/fusionauth/app/TokenActivity.java`: From dfcc072c154e1d1fd268f55e4ead40f0f283c87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Campitelli?= <1877191+vcampitelli@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:22:47 -0300 Subject: [PATCH 11/14] :memo: refs #2415 Removing links to `fusionauth.io` --- .../quickstarts/quickstart-android-java.mdx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/astro/src/content/quickstarts/quickstart-android-java.mdx b/astro/src/content/quickstarts/quickstart-android-java.mdx index 6ce4257c2e..61df642b57 100644 --- a/astro/src/content/quickstarts/quickstart-android-java.mdx +++ b/astro/src/content/quickstarts/quickstart-android-java.mdx @@ -29,7 +29,7 @@ https://github.com/FusionAuth/fusionauth-quickstart-java-android-native - [Android Studio](https://developer.android.com/studio): The official IDE for Android will help you develop and install necessary tools to set it up. - There, you need to [install at least JDK 17](https://developer.android.com/build/jdks). - [Git](https://git-scm.com/site): You'll use it to clone the base repository. -- [Docker](https://www.docker.com): The quickest way to stand up FusionAuth. (There are [other ways](https://fusionauth.io/docs/v1/tech/installation-guide/)). +- [Docker](https://www.docker.com): The quickest way to stand up FusionAuth. (There are [other ways](/docs/v1/tech/installation-guide/)). This app was built on top of the [AppAuth demo app](https://github.com/openid/AppAuth-Android), which is a client SDK for communicating with OAuth 2.0 and OpenID Connect providers, and it supports Android API 16 (Jellybean) and above. @@ -68,7 +68,7 @@ In the root directory of the repo you'll find a Docker compose file (`docker-com docker compose up -d ``` -Here you are using a bootstrapping feature of FusionAuth, called [Kickstart](https://fusionauth.io/docs/v1/tech/installation-guide/kickstart). When FusionAuth comes up for the first time, it will look at the `kickstart/kickstart.json` file and configure FusionAuth to a certain initial state. +Here you are using a bootstrapping feature of FusionAuth, called [Kickstart](/docs/v1/tech/installation-guide/kickstart). When FusionAuth comes up for the first time, it will look at the `kickstart/kickstart.json` file and configure FusionAuth to a certain initial state.