https://github.com/joemart/my-api
Display your WoW characters! (NA only, still working on Starcraft and Diablo!)
https://github.com/joemart/my-api
api blizzard-api nextauth nextjs oauth scss
Last synced: 28 days ago
JSON representation
Display your WoW characters! (NA only, still working on Starcraft and Diablo!)
- Host: GitHub
- URL: https://github.com/joemart/my-api
- Owner: joemart
- Created: 2023-11-07T17:48:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-03T22:02:44.000Z (over 2 years ago)
- Last Synced: 2025-03-31T03:32:08.707Z (about 1 year ago)
- Topics: api, blizzard-api, nextauth, nextjs, oauth, scss
- Language: TypeScript
- Homepage: https://my-api-nu-ten.vercel.app
- Size: 12.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a NextJS project that will use SCSS and an API to display data about [cards](https://rapidapi.com/omgvamp/api/hearthstone/).
[Battle.net api documentation](https://develop.battle.net/documentation/guides)
Add [chartjs](https://www.chartjs.org/)?
Use OAuth 2.0?
Create a client in the [developer portal](https://develop.battle.net/access/clients). Use the Client ID and Client Secret in your app by placing them in
the [...nextauth].ts file as such:
```tsx
export const authConfig: NextAuthOptions = {
providers: [
BattleNetProvider({
clientId: process.env.BNET_CLIENT_ID as string,
clientSecret: process.env.BNET_CLIENT_SECRET as string,
issuer: "https://us.battle.net/oauth",
}),
GithubProvider({
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
}),
],
}
```
NOTE: Make sure that the issuer and the account logging in are from the same region.
There's 2 kinds of OAuth that the `battlenet provider` requests:
1. CLient credentials flow
2. Authorization code flow
`Next-auth` already does the `Authorization code flow` approach.
Use the `jwt` and `session` call back functions to pass the `access token` to the
frontend.
Once we have the `access token` we can start making API calls as long as it's included
in the parameters.
The `WoW` API is the only one working. The `SC2` and `D3` need `{account}`
and `:profileId` in their parameters and for some reason they don't work with the API requests.
A few project references:
1. [border images](https://www.youtube.com/watch?v=ypstT5UfCsk)