An open API service indexing awesome lists of open source software.

https://github.com/curityio/oauth-assistant-example

A vanilla JavaScript SPA that uses the OAuth Assistant
https://github.com/curityio/oauth-assistant-example

code-example oauth-assistant oauth2 openid-connect spa

Last synced: 4 months ago
JSON representation

A vanilla JavaScript SPA that uses the OAuth Assistant

Awesome Lists containing this project

README

          

# Curity OAuth Assistant Example App

This is a trivial example application that shows how to use the [@curity/oauth-assistant](https://www.npmjs.com/package/@curity/oauth-assistant) to perform OAuth flows and OpenID Connect session management. The example is written using vanilla Javascript.

## Run the Application

Point the example to your instance of the Curity Identity Server:

```shell
export OAUTH_ASSISTANT_EXAMPLE_BASE_URL='http://localhost:8443'
export OAUTH_ASSISTANT_EXAMPLE_ISSUER='http://localhost:8443/oauth/v2/oauth-anonymous'
```

Then run the application at `http://localhost:8080` with the following commands:

```shell
npm i
npm start
```

## Run the Curity Identity Server

If you do not have an instance, run one using Docker:

```shell
docker run -it -e PASSWORD=Password1 -p 6749:6749 -p 8443:8443 curity.azurecr.io/curity/idsvr
```

Then log in to the Admin UI at `https://localhost:6749/admin` with credentials `admin / Password1`.\
Then [run the first configuration](https://curity.io/resources/learn/first-config/) and accept all defaults.

To prepare the Curity Identity Server you can save the following XML to a file.\
Then use the Admin UI to upload and merge it using the `Changes / Upload` option.

```xml



authentication-service
auth:authentication-service




html1

default-account-manager
default-credential-manager







token-service
as:oauth-service





oauth-assistant-client
true
http://localhost:8080/assisted.html
http://localhost:8080/
openid

html1
http://localhost:8080/assisted.html

https://localhost:8443
http://localhost:8080











```

## Further Information

See the following resources to learn more about running the example and the OAuth Assistant library:

- [OAuth Assistant Example Tutorial](https://curity.io/resources/learn/oauth-assistant/)
- [Running OAuth flows with the Curity Identity Server and OAuth Assistant](https://curity.io/resources/learn/test-using-oauth-assistant/)
- [OAuth Assistant npm page](https://www.npmjs.com/package/@curity/oauth-assistant)