Skip to content

Commit

Permalink
Deprecate RequestWebAPIUserNonce
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Oct 19, 2023
1 parent a371559 commit c3f37c0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions SteamKit2/SteamKit2/Steam/Handlers/SteamUser/SteamUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ public void SendMachineAuthResponse( MachineAuthDetails details )
/// The returned <see cref="AsyncJob{T}"/> can also be awaited to retrieve the callback result.
/// </summary>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="WebAPIUserNonceCallback"/>.</returns>
[Obsolete( "Steam no longer uses web api nonces as of October 2023, use SteamAuthentication." )]
public AsyncJob<WebAPIUserNonceCallback> RequestWebAPIUserNonce()
{
var reqMsg = new ClientMsgProtobuf<CMsgClientRequestWebAPIAuthenticateUserNonce>( EMsg.ClientRequestWebAPIAuthenticateUserNonce );
Expand Down

2 comments on commit c3f37c0

@belikr
Copy link

@belikr belikr commented on c3f37c0 Oct 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to use SteamAuthentication?

@Christian-Stieber
Copy link

@Christian-Stieber Christian-Stieber commented on c3f37c0 Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@belikr I've asked myself the same question for a different project.

What seems to work for me right now is to remember the "access token" that you get during the Steam login. I haven't had a use for that yet -- now there seems to be one.

Update: this access token has an expiration, so I dropped the "save it on login". Instead, you can use the Authentication.GenerateAccessTokenForApp#1 service call to get an access token for your refresh token. Since they just referred Nonce users to the SteamAuthentication stuff, I presume SteamKit has builtin support for getting the access token. Else it's pretty easy -- you just call that service through whatever RPC/UnifiedMessage support they have; it only takes your SteamID and the login refresh token as parameters.

Use this access token to construct the "steamLoginSecure" cookie to include on your web requests, as a string <SteamID>||<AccessToken>.
Example: steamLoginSecure=765611...||eyAid...

This seems to do it for me right now, but I'm still considering it to be work in progress. It seems the old CMsgClientRequestWebAPIAuthenticate* stuff is no longer needed (I stumbled onto this because CMsgClientRequestWebAPIAuthenticateUserNonce stopped giving any anwers... and I figured SteamKit has probably discovered the same since they put a lot more effort into stuff than I do). However, I'm only using it for a few things right now and haven't even tested all of these yet -- right now, I'm back to being able to claim sale stickers and read my inventory, so it's promising.

Please sign in to comment.