altmp / altv-issues

Issues and roadmap for alt:V project
93 stars 17 forks source link

Add a Way to retrieve the Player-Name in Early-Auth #723

Closed JulianMa closed 2 years ago

JulianMa commented 3 years ago

Suggestion I like to recommend a Way to retrieve the current Player's name in the Early-Auth CEF Window. This can be an Event, which is being sent to the Browser and on which Scripts can listen to. This way Players dont have to type in their Username.

Use cases Select Server from Server-List -> Early-Auth Window opens -> Username is already set in Login-Field Only the Password needs to be typed in.

Describe the solution you'd like Add an event, which is sent after the document has finished loading. JavaScript in Browser can then Listen to this Event, like this: alt.on('player.name', (name) => { console.log(name)})

Describe alternatives you've considered Dont change anything, but then users have to type in their name everytime they are connecting

JulianMa commented 3 years ago

@Lhoerion the Scope is purely Client-Side. It's only about Client<->CEF Communication. No Server is needed here.

FabianTerhorst commented 3 years ago

This is about process to process communication between cef and the client.

Unnvaldr commented 3 years ago

@Lhoerion the Scope is purely Client-Side. It's only about Client<->CEF Communication. No Server is needed here.

Ye, it happens sometimes that wrong label is added

7Hazard commented 3 years ago

You can use local storage or the existing web features to save session information or token credentials for something like a "remember me" functionality. If the current web features is not sufficient for you, are lacking or somehow don't work as intended, please open a more specific issue for that.

Using the players nickname is not a reliable way to do authentication anyway.

JulianMa commented 3 years ago

@7Hazard i think you missunderstood the issue there. We dont want to save some credentials/sessions, or authenticate the player only by their Nickname. In our Implementation, we have a Login Page in Early Auth, which sets the Auth Token for the Player, when the Login Credentials Match (Username / Password). We basicly just want to "autofill" the Username Input-Field in the CEF-Window with the already entered Username in the alt:V Settings Tab:

image

At the current state of early auth, player have to enter their Username two different times:

  1. Settings -> Username
  2. EarlyAuth Window

We try to reduce this to a single time.

JulianMa commented 3 years ago

What about sending a Request-Header, with the current Playername in the Settings?

FabianTerhorst commented 2 years ago

Added in next release.

zziger commented 2 years ago

How can we get it? Where will be the docs about that?

C0kkie commented 2 years ago

You can emit in the earlyauth

alt.emit("requestPlayerName")

and then you will get a event in the early auth

alt.on("playerName", (name) => { //Do what ever you want with the same in earlyauth })

JulianMa commented 2 years ago

Can someone maybe document this here? I tried, but dont have the rights to do so. https://wiki.altv.mp/wiki/Tutorial:Setup_EarlyAuth

C0kkie commented 2 years ago

That one is outdated, it will be moved to the docs