# Setup Development Environment

## Auth Server Setup

***

1. Clone [didPass repository](https://github.com/GDP-ADMIN/didPass) then checkout to `development` branch

<pre><code><strong>git clone https://github.com/GDP-ADMIN/didPass.git
</strong></code></pre>

2. Copy auth-server `.env.example` as `.env` and [Set Environment Variables](#set-environment-variables) in `.env`

## Set Environment Variables

***

1. Setup Auth0
   1. Create new [Application](https://manage.auth0.com/dashboard/us/application), select Native

      <figure><img src="https://1112589903-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtTgcodhP2cUh2QvSVXyn%2Fuploads%2F21nIp6sGJlZQTh6MXBgY%2Fimage.png?alt=media&#x26;token=4f513dc8-8816-456b-a34c-5b7e572b03b4" alt="" width="375"><figcaption><p>Auth0 Create New Application</p></figcaption></figure>
   2. Select React Native as the `Native SDK`

      <figure><img src="https://1112589903-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtTgcodhP2cUh2QvSVXyn%2Fuploads%2F8sEMJnE16xMVfrASHrmg%2Fimage.png?alt=media&#x26;token=cf4d7ec5-1853-41cf-9f6d-e283076e70f0" alt="" width="375"><figcaption></figcaption></figure>
   3. Go to your application (from step 1 & 2) settings on [Auth0 site](https://auth0.com/)
   4. Copy `Domain` to `APP_ISSUER` value and `JWKS_URL` value

      ```
      APP_ISSUER=https://<placeholder(Auth0 Application Domain)>/
      JWKS_URL=https://<placeholder(Auth0 Application Domain)>/.well-known/jwks.json
      ```
   5. Copy `Client ID` to `APP_AUDIENCE` value

      ```
      APP_AUDIENCE=<placeholder(Auth0 Application Client ID)>
      ```
2. Setup Pinata
   1. Create new [API KEY](https://app.pinata.cloud/developers/api-keys), check the `Admin` option and set the `Key Name` (any name)

      <figure><img src="https://1112589903-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtTgcodhP2cUh2QvSVXyn%2Fuploads%2FOUOrBHAXWX6LmG7JhMCM%2Fimage.png?alt=media&#x26;token=c0f59356-b948-4d89-9694-6aeed0d7a76e" alt="" width="371"><figcaption><p>Pinata Create New Key</p></figcaption></figure>
   2. Click `Create Key` Button
   3. Copy the `API Key` on pinata's site to `PINATA_API_KEY`

      ```
      PINATA_API_KEY=<placeholder(Pinata API key)>
      ```
   4. Copy the `API Secret` on pinata's site to `PINATA_SECRET_API_KEY`

      ```
      PINATA_SECRET_API_KEY=<placeholder(Pinata Secret API key)>
      ```
3. Run ngrok `ngrok http 3000`, copy forwarding url and fill `NEXT_PUBLIC_URL` value.

```
NEXT_PUBLIC_URL=<placeholder(ngrok Forwarding URL)>
```

Here is the full `.env`

```
APP_ISSUER=https://<placeholder(Auth0 Application Domain)>/ #(example: https://tenant.region.auth0.com/)
APP_AUDIENCE=<placeholder(Auth0 Application Client ID)> #Client ID of your Auth0 application
JWKS_URL=https://<placeholder(Auth0 Application Domain)>/.well-known/jwks.json #{APP_ISSUER}/.well-known/jwks.json
PINATA_API_KEY=<placeholder(Pinata API key)>
PINATA_SECRET_API_KEY=<placeholder(Pinata Secret API key)>
NEXT_PUBLIC_URL=<placeholder(ngrok Forwarding URL)>
KEY_ID=v1
```
