{"id":16426296,"url":"https://github.com/sanny-io/steamlogin","last_synced_at":"2026-04-21T13:02:36.797Z","repository":{"id":57139290,"uuid":"379763496","full_name":"sanny-io/steamlogin","owner":"sanny-io","description":"Dead simple functions for logging in through Steam.","archived":false,"fork":false,"pushed_at":"2022-04-30T05:30:05.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T05:47:16.491Z","etag":null,"topics":["auth","authentication","backend","frontend","login","node","steam","steamauth","steamlogin"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@sanny-io/steamlogin","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanny-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-24T00:42:58.000Z","updated_at":"2022-01-26T15:28:19.000Z","dependencies_parsed_at":"2022-09-04T18:20:16.987Z","dependency_job_id":null,"html_url":"https://github.com/sanny-io/steamlogin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanny-io%2Fsteamlogin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanny-io%2Fsteamlogin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanny-io%2Fsteamlogin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanny-io%2Fsteamlogin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanny-io","download_url":"https://codeload.github.com/sanny-io/steamlogin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240594134,"owners_count":19826106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","authentication","backend","frontend","login","node","steam","steamauth","steamlogin"],"created_at":"2024-10-11T08:08:25.493Z","updated_at":"2026-04-21T13:02:31.752Z","avatar_url":"https://github.com/sanny-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @sanny-io/steamlogin\n\nDead simple functions for logging in through Steam. Works great with SPAs, server rendered pages, and cloud functions. No messing around with OpenID required.\n\n## Installation\n\n```\nnpm i @sanny-io/steamlogin\n```\n\n## Example\n\nAn example with server validation can be found in this repository's [`example`](example) folder.\n\n## Client\n\n### Using an `href`\n\n```jsx\nimport React from 'react'\nimport { getSteamLoginUrl } from '@sanny-io/steamlogin'\n\nconst returnUrl = 'http://localhost:3000/auth'\n\nexport default function LoginButton() {\n    return \u003ca href={getSteamLoginUrl(returnUrl)}\u003eLogin through Steam\u003c/a\u003e\n}\n```\n\n### Using an `onClick` handler\n\n```jsx\nimport React from 'react'\nimport { doSteamLogin } from '@sanny-io/steamlogin'\n\nconst returnUrl = 'http://localhost:3000/auth'\nconst handleClick = () =\u003e doSteamLogin(returnUrl)\n\nexport default function LoginButton() {\n    return \u003cbutton onClick={handleClick}\u003eLogin through Steam\u003c/button\u003e\n}\n```\n\nThe snippet below is only necessary if `returnUrl` is an SPA. This would be the `http://localhost:3000/auth` route in our example.\n\nIf `returnUrl` is a server, you can simply skip to the server section.\n\n```jsx\nimport React, { useEffect } from 'react'\nimport axios from 'axios'\nimport { getSteamLoginResponse, getSteamIdFromResponse } from '@sanny-io/steamlogin'\n\nexport default function AuthRoute() {\n    const response = getSteamLoginResponse()\n\n    // If you need to validate the login, send it to the server\n    // with fetch, axios, etc...\n\n    // OR\n\n    // If you don't need to validate the login, you can immediately\n    // start using the 64-bit Steam ID of the user.\n    const steamId = getSteamIdFromResponse(response)\n}\n```\n\n## Server\n\n```typescript\n// If you're using ES modules.\nimport steamlogin from '@sanny-io/steamlogin'\n\n// If you're using CommonJS.\nconst steamlogin = require('@sanny-io/steamlogin')\n\n// Get the response through express, cloud functions, etc...\n// ...\n\n// Then validate it like so.\nsteamlogin.validateSteamLogin(response)\n.then(steamId =\u003e {\n    // We have the 64-bit Steam ID of the user, validated by Steam.\n})\n```\n\nPlease note that **a response can only ever be validated once.** Subsequent attempts will always fail.\n\n## `response`\n\nIt's an object that Steam sends to the specified `returnUrl` through GET parameters after the user has logged in.\n\nIf `returnUrl` is a client (like an SPA), `getSteamLoginResponse` creates this object for you. If you need to validate the login, you must send it to a server and call `validateSteamLogin` over there. Otherwise, you can immediately start using the 64-bit Steam ID of the user with `getSteamIdFromResponse`.\n\nIf `returnUrl` is a server (like express), this object can be accessed through your server software's GET parameters. **You shouldn't directly use `getSteamIdFromResponse` on the server, as it doesn't perform any validation.** You should instead get the Steam\nID through `validateSteamLogin`.\n\n```typescript\n{\n    ['openid.assoc_handle']: \"1234567890\"\n    ['openid.claimed_id']: \"https://steamcommunity.com/openid/id/XXXXXXXXXXXXXX\"\n    ['openid.identity']: \"https://steamcommunity.com/openid/id/XXXXXXXXXXXXXX\"\n    ['openid.mode']: \"id_res\"\n    ['openid.ns']: \"http://specs.openid.net/auth/2.0\"\n    ['openid.op_endpoint']: \"https://steamcommunity.com/openid/login\"\n    ['openid.response_nonce']: \"2021-06-11T00:20:52Z7yoVVmrWgSENuw60w8rj2zZ82K4=\"\n    ['openid.return_to']: \"http://localhost:3000/auth\"\n    ['openid.sig']: \"XXXXXXXXXXXXXX\"\n    ['openid.signed']: \"signed,op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle\"\n}\n```\n\nLooks like a bunch of junk, huh? *Because it is.* Just give this object to the `validateSteamLogin` function and it'll confirm with Steam that everything checks out, with the final result being the user's 64-bit Steam ID.\n\n## Next Steps\n\nStart using the Steam API.\n\nhttps://www.npmjs.com/package/steamapi","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanny-io%2Fsteamlogin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanny-io%2Fsteamlogin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanny-io%2Fsteamlogin/lists"}