Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 2.32 KB

File metadata and controls

78 lines (53 loc) · 2.32 KB

OAuth for Native Apps Code Examples

These examples illustrate how to integrate OAuth into the different types of native clients.

Deploy the System

Deploy the system on a computer running Linux, macOS or Windows (with Git bash).
First ensure that you have these tools installed:

  • A Docker Engine, preferably configured to use 16GB of RAM
  • KIND
  • kubectl
  • Helm
  • OpenSSL 3 to create cookie encryption keys
  • The envsubst tool, to update configuration dynamically

Create the Cluster

Create a cluster and run a load balancer to enable the API to be exposed on an external IP address.
On Windows, use a Run as administrator shell in order to run the load balancer:

./1-create-cluster.sh

Deploy the API gateway

Then run another shell to deploy an ingress controller to act as an API gateway.
On macOS accept the prompt to allow the load balancer to accept connections.
Note the external IP address that the script outputs:

./2-deploy-api-gateway.sh

Update your hosts file with the external IP address, similar to the following:

172.18.0.5 api.democluster.example login.democluster.example admin.democluster.example

Deploy the Authorization Server

Deploy the authorization server with some preconfigured clients and users.
This requires a license file for the particular authorization server we use:

export LICENSE_FILE_PATH='license.json'
./3-deploy-authorization-server.sh
  • Login to the Admin UI at https://admin.democluster.example/admin with credentials admin / Password1
  • Locate OpenId Connect metadata at https://login.democluster.example/oauth/v2/oauth-anonymous/.well-known/openid-configuration

Deploy the Example API

The example API is called by native clients:

./4-deploy-api.sh

Run Native Applications

Follow the READMEs specific to each client:

Tear Down the Cluster

Run this command to free resources:

./5-delete-cluster.sh