This is a Next.js project bootstrapped with create-next-app
.
You will need to create your own app at https://www.bungie.net/en/Application.
We will add the credentials from this app into your local environment file in the next step
Configure the fields in your app to be just like this screenshot.
Make sure you have set the
OAuth Client Type
dropdown,Scope
checkboxs andOrigin Header
text field to match exactly with what is in the screenshot.
The Website
text field can just point to your fork of the repo. It doesn't really matter.
Create a file named .env.local
in the root directory and add these keys. Check the screenshot above to see where these keys come from.
NEXT_PUBLIC_BNET_API_KEY=whatever
NEXT_PUBLIC_BNET_OAUTH_CLIENT_ID=whatever
BNET_OAUTH_CLIENT_SECRET=whatever
If you want to locally develop any feature that touches the DIM loadouts integration you will need a DIM API Key. You can get a DIM API Key that will work for localhost
by following these instructions.
Add that key to .env.local
like so:
NEXT_PUBLIC_DIM_API_KEY=whatever
Install the required npm packages. From the root directory run:
npm i
The Bungie API requires that your app run using https due to some OAuth stuff. To make https work locally we hack up a local ssl certificate.
Run these commands from the root directory (source):
brew install mkcert
mkcert -install
mkcert localhost
Follow the instructions here to install mkcert. After installing it, run the following commands in the project repo:
mkcert -install
mkcert localhost
From the root directory run
npm run dev
If on windows, open two powershell terminals and run each command in one terminal:
npx local-ssl-proxy --source 4001 --target 3001 --cert localhost.pem --key localhost-key.pem
npx next dev -p 3001
Open http://localhost:4001 in your browser to see the result.
You can start editing any file and see your changes automatically propagate to the browser.
In chrome you may need to enable this flag: chrome://flags/#allow-insecure-localhost
Just push to master. It will deploy automatically here.