Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 05:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] Gameforge NoS0577 token generation

Discussion on [C#] Gameforge NoS0577 token generation within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
[C#] Gameforge NoS0577 token generation

I'm just sharing some code i've made for a personnal project, allowing you to easily generate NoS0577 token since it's looks like it's the only way to connect for newest accounts, it can be useful if you want to create a C# clientless application.

Code:
public sealed class GameforgeAuth : IGameforgeAuth
{
    private const string URL = "https://spark.gameforge.com/api/v1";
    private const string USER_AGENT = "GameforgeClient/2.0.48";
    private const string MEDIA_TYPE = "application/json";
    
    private readonly HttpClient _httpClient;

    public GameforgeAuth()
    {
        _httpClient = new HttpClient();
    }

    public async Task<string> GetAuthToken(string email, string password, string locale, Guid installationId)
    {
        string json = JsonConvert.SerializeObject(new AuthRequest
        {
            Locale = locale,
            Email = email,
            Password = password
        });
        
        using var request = new HttpRequestMessage(HttpMethod.Post, $"{URL}/auth/sessions")
        {
            Content = new StringContent(json, Encoding.UTF8, MEDIA_TYPE)
        };
        request.Headers.Add("TNT-Installation-Id", installationId.ToString());
        
        HttpResponseMessage response = await _httpClient.SendAsync(request);
        if (!response.IsSuccessStatusCode)
        {
            return string.Empty;
        }
        
        string content = await response.Content.ReadAsStringAsync();
        Dictionary<string, string> jsonContent = JsonConvert.DeserializeObject<Dictionary<string, string>>(content);

        return jsonContent.GetValueOrDefault("token") ?? string.Empty;
    }

    public async Task<IEnumerable<GameforgeAccount>> GetAccounts(string token, Guid installationId)
    {
        using var request = new HttpRequestMessage(HttpMethod.Get, $"{URL}/user/accounts");
        
        request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
        request.Headers.Add("User-Agent", USER_AGENT);
        request.Headers.Add("TNT-Installation-Id", installationId.ToString());
        
        HttpResponseMessage response = await _httpClient.SendAsync(request);
            
        if (!response.IsSuccessStatusCode)
        {
            return new List<GameforgeAccount>();
        }
            
        string content = await response.Content.ReadAsStringAsync();
        Dictionary<string, GameforgeAccount> jsonContent = JsonConvert.DeserializeObject<Dictionary<string, GameforgeAccount>>(content);

        return jsonContent?.Values.ToArray() ?? Array.Empty<GameforgeAccount>();
    }

    public async Task<string> GetSessionToken(string token, GameforgeAccount gameforgeAccount, Guid installationId)
    {
        using var request = new HttpRequestMessage(HttpMethod.Post, $"{URL}/auth/thin/codes");
        
        request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
        request.Headers.Add("User-Agent", USER_AGENT);
        request.Headers.Add("TNT-Installation-Id", installationId.ToString());
        
        string json = JsonConvert.SerializeObject(new SessionRequest
        {
            PlatformGameAccountId = gameforgeAccount.Id
        });

        request.Content = new StringContent(json, Encoding.UTF8, MEDIA_TYPE);

        HttpResponseMessage response = await _httpClient.SendAsync(request);

        if (!response.IsSuccessStatusCode)
        {
            return string.Empty;
        }

        string content = await response.Content.ReadAsStringAsync();
        Dictionary<string, string> jsonContent = JsonConvert.DeserializeObject<Dictionary<string, string>>(content);

        return (jsonContent.GetValueOrDefault("code") ?? string.Empty).ToHex();
    }
}
Code:
public sealed class GameforgeAccount
{
    public string Id { get; set; }
    
    [JsonProperty("displayName")]
    public string Name { get; set; }

    public override string ToString() => $"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}";
}
Code:
public sealed class GameforgeAccount
{
    public string Id { get; set; }
    
    [JsonProperty("displayName")]
    public string Name { get; set; }

    public override string ToString() => $"{nameof(Id)}: {Id}, {nameof(Name)}: {Name}";
}
Code:
public sealed class SessionRequest
{
    [JsonProperty("platformGameAccountId")]
    public string PlatformGameAccountId { get; set; }
}
Roxeez is offline  
Thanks
13 Users
Old 01/02/2020, 21:31   #2
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
Added
Code:
Task<Optional<IEnumerable<GameforgeAccount>>> GetAllAccounts(string authToken, Guid installationId);
For accounts with multiple game account
Roxeez is offline  
Thanks
1 User
Old 05/03/2020, 09:41   #3
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
Updated with new endpoint/requests
Roxeez is offline  
Reply


Similar Threads Similar Threads
Creating NoS0577 C++ Packet
05/19/2020 - Nostale - 17 Replies
Hi, I've been dealing with the new nos0577 packet trying to do something just for learning purpose. I came through the NosAuth by Walross that Pumba suggested me, and some more snippet codes for the SESSION_TOKEN but I don't know how to implement in c++ since they are written in Python. I read about the libcurl and QtHttpRequest but honestly, Idk how to send a post req in c++ and send a json and vice-versa. Or maybe using a python script from a c++ program? Can anyone help me?
Turn T5 token into T6 token
05/11/2008 - WoW Exploits, Hacks, Tools & Macros - 26 Replies
The other day I got the T5 gloves token off Leo in SSC. I already had my T5 gloves so I got it with the intention of turning it into the PVP gear vendor at Quel'Danas for the S2 Merciless Gladiator Gloves. After doing so I realized that I already had the S3 Vengeful Gladiator Gloves. One thing to note is that turning in either a T5 token or a T6 token still gives you the S2 gear. Therefore, since T5 and T6 can be turned into S2 gear, I got the S2 gloves. I then put in a ticket claiming...



All times are GMT +1. The time now is 05:01.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.