Skip to content

Commit

Permalink
Merge pull request #637 from dfinity/add-auth-client-demo-to-examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dfx-json authored Jan 9, 2024
2 parents 1ce27ef + 46ec49a commit 456e1de
Show file tree
Hide file tree
Showing 55 changed files with 25,636 additions and 0 deletions.
34 changes: 34 additions & 0 deletions motoko/auth_client_demo/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: "tagged-release"

on:
push:
tags:
- "v*"

jobs:
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v1
with:
node-version: 16
- name: "Install Packages"
run: npm install

- name: "Install DFX"
run: echo y | sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"

- name: "Release"
run: npm run release

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
dist/*
18 changes: 18 additions & 0 deletions motoko/auth_client_demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Various IDEs and Editors
.vscode/
.idea/
**/*~

# Mac OSX temporary files
.DS_Store
**/.DS_Store

# dfx temporary files
.dfx/

# frontend code
node_modules/
dist/
.env

src/declarations
56 changes: 56 additions & 0 deletions motoko/auth_client_demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Auth-Client Demo

This is an example project, intended to demonstrate how an app developer might integrate with an [Internet Identity](https://identity.ic0.app).

For a non-typescript implementation, see https://github.com/krpeacock/auth-client-demo/tree/vanilla-js

[Live demo](https://vasb2-4yaaa-aaaab-qadoa-cai.ic0.app/)

This is an example showing how to use [@dfinity/auth-client](https://www.npmjs.com/package/@dfinity/auth-client).

## Setting up for local development

To get started, start a local dfx development environment in this directory with the following steps:

```bash
cd auth-client-demo/
dfx start --background --clean
dfx deps deploy
dfx deploy
```

Once deployed, start the development server with `npm start`.

You can now access the app at `http://127.0.0.1:5173/`.

## Multiple Versions

This demo has multiple versions, each of which demonstrates a different feature of the auth-client. `npm start` will run the vanilla JS version, but you can run the others by running `npm run start:version` where `version` is one of the following:

- React
- Vue
- Vanilla
- Svelte

## Pulling Internet Identity into your own project

To pull Internet Identity into your own project, you'll need to do the following:

1. Add Internet Identity to your `dfx.json` file:

```json
"internet-identity" : {
"type": "pull",
"id": "rdmx6-jaaaa-aaaaa-aaadq-cai"
}
```

2. Run the following commands to install the dependencies:

```bash
dfx deps pull
dfx deps init --argument '(null)' internet-identity
dfx deps deploy
```


16 changes: 16 additions & 0 deletions motoko/auth_client_demo/canister_ids.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"auth_client_demo_assets": {
"ic": "vasb2-4yaaa-aaaab-qadoa-cai"
},
"svelte": {
"ic": "rxrf5-eiaaa-aaaab-qaihq-cai"
},
"whoami": {
"ic": "ivcos-eqaaa-aaaab-qablq-cai",
"ic-old": "hihv6-xiaaa-aaaab-qaapa-cai"
},
"www": {
"ic": "jymk4-lyaaa-aaaab-qabma-cai",
"ic-old": "hpgtk-2qaaa-aaaab-qaapq-cai"
}
}
Loading

0 comments on commit 456e1de

Please sign in to comment.