Web
This article guides you through setting up Steam as an identity provider, enabling your website to access Player Network authentication services.
Prerequisites
The Steam Web API limits requests to 100,000 per day. For more information on Steam request limits, see Steam Web API Terms of Use.
For players to log in to your Windows game through Steam, they must have the Steam client software installed on their devices and have already logged in to Steam.
- Set up the Steam app on the Steam official website after applying for a developer account to obtain an App ID for the game.
- Create an account for Player Network Console.
- Create a new project for your game, or join an existing one.
- Add Steam as an authentication method for your project on Player Network Console.
For more details about integrating the SDK for other third-party channels, see JavaScript SDK.
Step 1: Install the JavaScript SDK
Install the JavaScript SDK from npm
or CDN
.
- npm
- CDN
$ npm install @intlsdk/account-api
// SDK production version package
<script src="https://common-web.intlgame.com/sdk-cdn/account-api/latest/index.umd.js"></script>
Step 2: Instantiate the SDK
Set env
to the test environment during the integration testing and env
to the corresponding production environment when launching the game.
const accountApi = new IntlgameAccountApi({
env: "test", // SDK environment
gameID: 11,
});
Parameter | Type | Description | Remark |
---|---|---|---|
env | string | SDK environment For more information, see Retrieve cluster information. | Required |
gameID | number | Unique game ID assigned by Player Network | Required |
Step 3: Implement web login
After instantiating the accountApi
component, call the thirdAuthorize
method to request the attributes required for Steam web login. For more information on the exact attributes required, see Steam Channel Information.
accountApi.thirdAuthorize({
third_type: 'steam',
}).then(
(res) => {
console.log(res);
});
With the Steam attributes returned, call the intlAuthorize
method to get the Player Network SDK OpenID and token to log in to your website.
accountApi.intlAuthorize({
third_type: 'steam',
channel_info: {
openid.ns: "EAAI2lTrXAZBwBAC",
openid.mode: "EAAI2lTrXAZBwBAC",
openid.op_endpoint: "EAAI2lTrXAZBwBAC",
openid.claimed_id: "EAAI2lTrXAZBwBAC",
openid.identity: "EAAI2lTrXAZBwBAC",
openid.return_to: "EAAI2lTrXAZBwBAC",
openid.response_nonce: "EAAI2lTrXAZBwBAC",
openid.assoc_handle: "EAAI2lTrXAZBwBAC",
openid.signed: "EAAI2lTrXAZBwBAC",
openid.sig: "EAAI2lTrXAZBwBAC",
}
}).then(
(res) => {
console.log(res);
});
Call the intlLogout
method to log out from your website.
accountApi.intlLogout({
token: '4567xsdfsd',
openid: 'xxxxxxxx',
channel_id: 21,
}).then(
(res) => {
console.log(res);
});