Steamworks-dokumentation
Brugergodkendelse og ejerskab

Oversigt

Steamworks har flere metoder til at bekræfte en Steam-brugers identitet og bekræfte ejerskab af en applikation. Det følgende dokument beskriver hver af disse godkendelsesmetoder, som bruges i de følgende scenarier:

Identificering af en bruger indenfor Steam

Hver Steam-bruger kan identificeres entydigt ud fra et 64-bit numerisk ID, kendt som brugerens Steam-ID. En brugers Steam-ID er i Steamworks C++-API'er indeholdt i et CSteamID-objekt. Du kan hente den nuværende brugers Steam-ID ved at kalde ISteamUser::GetSteamID og derefter hende 64-bit-ID'et ved at kalde CSteamID.ConvertToUint64() på den returnerede værdi.

De følgende godkendelsesmetoder kan bruges til sikkert at bekræfte en brugers Steam-ID.

API'er beskrevet i dette dokument

Sessionsbilletter

Sessionsbilletter er signerede billetter, som kan bruges til at verificere en brugers identitet mellem brugerens spilklient og et vilkårligt antal af andre spilklienter (såsom i en peer-to-peer multiplayer-session) eller en lytte-/dedikeret spilserver (ved hjælp af ISteamGameServer API'en). Disse billetter kan også bruges til at bekræfte ejerskab af det aktuelle spil og relateret indhold, som kan downloades, og afgøre, om brugeren er blevet VAC-udelukket (se VAC (Valve Anti-Cheat) og spiludelukkelser).
Sessionsbilletter kan også bruges til at bekræfte en brugers identitet mellem en spilklient og en sikker backend-server ved at bruge Steamworks-web-API'en. Kræver, at den sikre server kan lave HTTPS-anmodninger til partner.steam-api.com.

Krypterede applikationsbilletter

Krypterede applikationsbilletter kan bruges til at bekræfte en brugers identitet mellem en spilklient og en sikker backend-server. I modsætning til sessionsbilletter kræver bekræftelse af krypterede applikationsbilletter ikke, at den sikre server kan lave HTTPS-anmodninger. I stedet bruges et C++-bibliotek og en privat, symmetrisk nøgle af den sikre server til at bekræfte billetten. Steamworks-SDK'en inkluderer 32-bit og 64-bit versioner af dette bibliotek for Windows og Linux under public/steam/lib-mappen.
Før du bruger krypterede applikationsbilletter, skal du generere en privat nøgle til hver titel. Du kan gøre dette ved at navigere til "Rediger Steamworks-indstillinger" for din applikation og vælge "SDK Auth" fra rullemenuen "Sikkerhed". Denne nøgle vil være tilknyttet dit titels app-ID og alt indhold, som kan downloades, til den pågældende titel.

Bemærk: Disse nøgler skal opbevares forsvarligt og må ikke distribueres i din applikation på nogen måde!

Steamworks-web-API

Steam har en HTTP-baseret web-API, som kan bruges til at få adgang til mange Steamworks-funktioner. API'en indeholder offentlige metoder, som kan tilgås fra enhver applikation, som er i stand til at lave en HTTP-anmodning, såsom spilklient eller server. API'en indeholder også beskyttede metoder, som kræver godkendelse og er beregnet til at blive tilgået fra betroede backend-applikationer. Flere detaljer om web-APi'en kan findes her.

P2P eller spilservere

Sessionsbilletter

Brugergodkendelse

De følgende trin beskriver, hvordan du bruger sessionsbilletter til at bekræfte en brugers identitet mellem brugerens spilklient (klient A) og en anden klient eller spilserver (klient B):

Et par vigtige noter vedrørende sessionsbilletter:

Bekræftelse af ejerskab

Når der bruges sessionsbilletter, vil Steam automatisk bekræfte ejerskab af det nuværende app-ID. Hvis brugeren ikke ejer det nuværende app-ID, vil m_eAuthSessionResponse-feltet tilhørende ISteamUser::ValidateAuthTicketResponse_t blive sat til k_EAuthSessionResponseNoLicenseOrExpired. Efter at have modtaget en brugers sessionsbillet og sendt den videre til ISteamUser::BeginAuthSession, ISteamUser::UserHasLicenseForApp bruges til at afgøre, om brugeren ejer det specifikke stykke indhold, som kan downloades.

Backend-server

Sessionsbilletter og Steamworks-web-API

Brugergodkendelse

The following steps detail how to use Session Tickets to verify a user's identity between the user's game client and a secure server:

Bekræftelse af ejerskab

Once a user's identity has been verified, a secure server can use the ISteamUser/CheckAppOwnership Web API method to check if the user owns a particular AppID, or call ISteamUser/GetPublisherAppOwnership to retrieve a list of all user owned AppIDs that are associated with the provided Publisher Key.

Krypterede applikationsbilletter

Brugergodkendelse

The following steps detail how to use Encrypted Application Tickets to verify a user's identity between the user's game client and a secure server:

An example implementation can be found in the Steamworks-API-eksempel på applikation (SpaceWar) project in the SDK. Specifically CSpaceWarClient::RetrieveEncryptedAppTicket and CSpaceWarClient::OnRequestEncryptedAppTicket.

Bekræftelse af ejerskab

Steam will only create Encrypted Application Tickets for users who own the AppID for which the ticket was created. After decrypting an Encrypted Application Ticket, the secure server can use SteamEncryptedAppTicket::BIsTicketForApp to verify the AppID of the ticket matches the title's AppID. The server can also use SteamEncryptedAppTicket::BUserOwnsAppInTicket to determine if the user owns a specific piece of Indhold, der kan downloades (DLC).

Webbrowserbaseret bekræftelse med OpenID

Steam is an OpenID Provider, as described in the OpenID 2.0 specification. Inside a web browser, a third-party website can use OpenID to obtain a user's SteamID which can be used as the login credentials for the 3rd party website, or linked to an existing account on that website.

When using OpenID, the user begins in a web browser at the third-party website. When the user wishes to login/link their account to that website, using OpenID, the site directs the user to a login form on the Steam Community website. Once the user has entered their Steam login credentials, the user's web browser is automatically redirected back to the 3rd party website with some additional OpenID specific data appended to the return URL. The site's OpenID library can then use this data to verify and obtain the user's SteamID.

Steam provides the following images which may be used by 3rd party sites when linking to the Steam sign in page:
sits_large_border.png

sits_large_noborder.png

sits_small.png

Brugergodkendelse

Steam's OpenID 2.0 implementation can be used to link a users Steam account to their account on the third-party website.
A list of open source OpenID libraries can be found at the OpenID website. To use OpenID to verify a user's identity:
  • Konfigurer dit OpenID-bibliotek for at bruge den følgende URL som Steam's OP Endpoint URL: https://steamcommunity.com/openid/
  • Efter en bruger er blevet bekræftet, vil brugerens tildelte ID indeholde brugerens Steam-ID. Steam's tildelte ID-format er:http://steamcommunity.com/openid/id/<steamid>.

Bekræftelse af ejerskab

Once a user's identity has been verified, a secure server can use the ISteamUser/CheckAppOwnership Web API method to check if the user owns a particular AppID, or call ISteamUser/GetPublisherAppOwnership to retrieve a list of all user owned AppIDs that are associated with the provided Web API Publisher Key.

Eksempler

Tilknytning af tredjepartskonti til Steam-konti

Third-party accounts can be linked to Steam accounts by associating a user's SteamID with the 3rd party account.

A user's SteamID can be securely retrieved either in-game or through a web browser and once the initial association has occurred, you can safely allow access to the 3rd party account by merely verifying a user's SteamID. This eliminates the need for Steam users to do any sort of secondary login to 3rd party account systems. Additionally, if new 3rd party accounts can be automatically created and linked when a new SteamID is encountered, the Steam user will never have to be aware that a secondary authentication is taking place at all. Instead, their single Steam account can grant access to all of their games, streamlining the user experience and removing potential barriers to installing and trying new games.

Tilknytning inde fra spil

Session Tickets can be used to verify a user's identity between a game client and a secure, backend server using the Steamworks Web API:

Tilknytning fra en webbrowser

Steam supports the OpenID 2.0 specification so that you can allow users to securly log into their Steam accounts from your website and retrieve their SteamID. For details on how to use OpenID with Steam go to Using OpenID

Bekræftelse af ejerskab

Once a user's identity has been verified, a secure server can use the ISteamUser/CheckAppOwnership Web API method to check if the user owns a particular AppID, or call ISteamUser/GetPublisherAppOwnership to retrieve a list of all user owned AppIDs that are associated with the provided Web API Publisher Key.

Overførsel fra tredjeparts-CD-nøgler til indbygget Steam-ejerskabstjek

Steam itself has a number of ways a title can authenticate a user with, removing the need for a third-party CD key. We've compiled a list of common use cases for CD Keys and how you might implement each case natively with Steam:

Adgang til private forummer

You'll want to have users login directly with their Steam account using OpenID. OpenID will return the user's 64bit SteamID which can then be used with ISteamUser/CheckAppOwnership to verify the user owns your appid. More details can be found above at Linking 3rd party accounts to Steam accounts.

Sådan låses der op for et ikke-Steam-spil, som er bygget uden DRM

Use OpenID and ISteamUser/CheckAppOwnership (documented above) to unlock the content on your own site. Alternatively, you could upload the DRM-free build as optional, free DLC.

Softwaren sælges på min egen hjemmeside og låses op med en nøgle

You'll want to have users login directly with their Steam account using OpenID. OpenID will return the user's 64bit SteamID which can then be used with ISteamUser/CheckAppOwnership to verify the user owns your appid. More details can be found in Tilknytning af tredjepartskonti til Steam-konti above.

Drop af genstande i spil til registrering af din tredjepartsnøgle

If you are using the Steam Inventory Service, make sure the item's itemdef is configured correctly as a promo item and call ISteamInventory::AddPromoItem from the client.
If you have your own item backend, you can call ISteamUser::GetAuthSessionTicket from the game client and then use ISteamUserAuth/AuthenticateUserTicket with ISteamUser/CheckAppOwnership to verify ownership. More Information...

Nøglen kontrollerer, hvilken version af softvaren der bliver låst op for

Each version of your game should have its own AppID. From the game client, call ISteamUser::GetAuthSessionTicket and then use ISteamUserAuth/AuthenticateUserTicket with ISteamUser/CheckAppOwnership to verify ownership. More Information...