A Deno package to orchestrate OpenID authentication flow with Steam.
Borrows from node-openid and 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.
OpenID flow confirmed to work with these frameworks:
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);
}
There's a simple Oak example in the example directory that demonstrates the flow. This assumes you have the latest version of Deno installed.
- Get a Steam API key
- Run
cp .env.example .env
- Replace
xxxxx
in new.env
file with your API key - Run
deno task example
- Open localhost:8000 and log in to Steam to be redirected to a page with your user information
deno task test
deno task fmt