https://github.com/brycedorn/deno-steam-openid
A Deno package to orchestrate OpenID authentication flow with Steam.
https://github.com/brycedorn/deno-steam-openid
authentication deno deno-module openid steam typescript
Last synced: 2 months ago
JSON representation
A Deno package to orchestrate OpenID authentication flow with Steam.
- Host: GitHub
- URL: https://github.com/brycedorn/deno-steam-openid
- Owner: brycedorn
- License: mit
- Created: 2022-07-19T16:19:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-26T12:58:20.000Z (almost 4 years ago)
- Last Synced: 2025-05-29T15:38:31.591Z (about 1 year ago)
- Topics: authentication, deno, deno-module, openid, steam, typescript
- Language: TypeScript
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# deno-steam-openid

[](https://github.com/brycedorn/deno-steam-openid/actions/workflows/deno.yml)
A [Deno](https://deno.land) package to orchestrate
[OpenID](https://openid.net/what-is-openid/) authentication flow with
[Steam](https://store.steampowered.com/).
Borrows from [node-openid](https://github.com/havard/node-openid) and
[node-steam-openid](https://www.npmjs.com/package/node-steam-openid) with
modifications to support the Deno runtime. Note: not all OpenID functionality is
supported; only authentication logic required to support flow with Steam.
## Usage
OpenID flow confirmed to work with these frameworks:
- [Fresh](https://fresh.deno.dev/)
- [Oak](https://oakserver.github.io/oak/)
```typescript
import { SteamAuth } from 'https://deno.land/x/deno_steam_openid/mod.ts';
// Initialize
const steam = new SteamAuth({
realm: Deno.env.get('DOMAIN'),
returnUrl: `${Deno.env.get('DOMAIN')}/auth`,
apiKey: Deno.env.get('API_KEY'),
});
// Redirect to Steam
const handler = async () {
const redirectUrl = await steam.getRedirectUrl();
}
// Handle redirect from Steam
const otherHandler = async (request) {
const user = await steam.authenticate(request);
}
```
## Example
There's a simple [Oak](https://deno.land/x/oak@v10.6.0) example in the
[example](https://github.com/brycedorn/deno-steam-openid/tree/main/example)
directory that demonstrates the flow. This assumes you have the latest version
of Deno [installed](https://deno.land/manual/getting_started/installation).
1. Get a [Steam API key](https://steamcommunity.com/dev/apikey)
1. Run `cp .env.example .env`
1. Replace `xxxxx` in new `.env` file with your API key
1. Run `deno task example`
1. Open [localhost:8000](http://localhost:8000) and log in to Steam to be
redirected to a page with your user information
## Test
```bash
deno task test
```
## Format
```bash
deno task fmt
```