Skip to content

Commit

Permalink
chore: ID-2098 Improvements to RainbowKit + NextJS + Passport sample (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
imx-mikhala authored Jul 15, 2024
1 parent 460e56d commit ec2166f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 2 additions & 0 deletions samples/apps/passport/next-rainbow-kit/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_PASSPORT_CLIENT_ID=PASSPORT_CLIENT_ID
NEXT_PUBLIC_IMMUTABLE_PUBLISHABLE_KEY=IMMUTABLE_PUBLISHABLE_KEY
13 changes: 7 additions & 6 deletions samples/apps/passport/next-rainbow-kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ Create a Passport application on Immutable Hub by following [these simple steps]

**Step 2**

Update `PUBLISHABLE_KEY` and `CLIENT_ID` in `src/app/passport.ts`
Copy `.env.example` to `.env` and set the `NEXT_PUBLIC_PASSPORT_CLIENT_ID` and `NEXT_PUBLIC_IMMUTABLE_PUBLISHABLE_KEY`

```typescript
// Immutable Publishable Key (you will find it in the Immutable Hub in the `API Keys` section)
const PUBLISHABLE_KEY = 'PUBLISHABLE_KEY';
// Hub Publishable Key (you will find it in the `Passport` section)
const CLIENT_ID = 'CLIENT_ID';
```sh
# Passport Client ID (you will find it in the Immutable Hub in the `Passport` section of your project)
NEXT_PUBLIC_PASSPORT_CLIENT_ID=PASSPORT_CLIENT_ID

# Immutable Publishable Key (you will find it in the Immutable Hub in the `API Keys` section of your project)
NEXT_PUBLIC_IMMUTABLE_PUBLISHABLE_KEY=IMMUTABLE_PUBLISHABLE_KEY
```

**Step 3**
Expand Down
7 changes: 2 additions & 5 deletions samples/apps/passport/next-rainbow-kit/src/app/passport.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { config, passport } from '@imtbl/sdk';

const PUBLISHABLE_KEY = 'PUBLISHABLE_KEY';
const CLIENT_ID = 'CLIENT_ID';

export const passportInstance = new passport.Passport({
baseConfig: {
environment: config.Environment.PRODUCTION,
publishableKey: PUBLISHABLE_KEY,
publishableKey: process.env.NEXT_PUBLIC_IMMUTABLE_PUBLISHABLE_KEY,
},
clientId: CLIENT_ID,
clientId: process.env.NEXT_PUBLIC_PASSPORT_CLIENT_ID ?? '',
redirectUri: 'http://localhost:3000/redirect',
logoutRedirectUri: 'http://localhost:3000/logout',
audience: 'platform_api',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@rainbow-me/rainbowkit/styles.css';
import { passportInstance } from '@/app/passport';
import { ConnectButton } from '@rainbow-me/rainbowkit';
import { useState } from 'react';
Expand Down

0 comments on commit ec2166f

Please sign in to comment.