/// <summary> /// Configures the <see cref="RequestEnvelope"/>'s authentication parameters. /// </summary> /// <param name="env">Request envelope instance.</param> public static void WithAuthenticationMessage(this RequestEnvelope env, AuthType authType, string authTokenContent) { Throw <ArgumentNullException> .If.IsNull(env)?.Now(nameof(env), "The provided envelop cannot be null during fluent configuration."); //We must create the AuthInfo first env.AuthInfo = new RequestEnvelope.Types.AuthInfo(); env.AuthInfo.Provider = authType.ToProtocolString(); //based on Rocket-API token building env.AuthInfo.Token = new RequestEnvelope.Types.AuthInfo.Types.JWT { //this is int32 unknown13 = 2; in Rocket-API's token. The seem to set it to 14 for some reason //https://github.com/FeroxRev/Pokemon-Go-Rocket-API/blob/master/PokemonGo.RocketAPI/Helpers/RequestBuilder.cs Unknown2 = 14, Contents = authTokenContent }; //Things that the user can't really deal with, because the community doesn't know what they really are, are initialized below. env.StatusCode = 2; //Rocket-API sets it to 2: https://github.com/FeroxRev/Pokemon-Go-Rocket-API/blob/bca2166d72aaa9799c64965cc4f94748231283eb/PokemonGo.RocketAPI/Helpers/RequestBuilder.cs env.Unknown12 = 989; //Required otherwise we receive incompatible protocol as indicated in Rocket-API: https://github.com/FeroxRev/Pokemon-Go-Rocket-API/blob/bca2166d72aaa9799c64965cc4f94748231283eb/PokemonGo.RocketAPI/Helpers/RequestBuilder.cs }