valorant.js icon indicating copy to clipboard operation
valorant.js copied to clipboard

Crash when Multifactor Authentication is enabled

Open Drysque opened this issue 3 years ago • 8 comments

Are you considering supporting MFA ?

I have MFA activated on my riot account, and the authorize method on the API class crashes.

parseTokensFromUrl(access_tokens.data.response.parameters.uri);

When MFA is active, their is no parameters property on data.response, but data about MFA instead.

Drysque avatar May 13 '22 07:05 Drysque

I am going to take a look into this problem and open a PR to fix it! @liamcottle I hope this is ok for you 🙃

SpatzlHD avatar May 13 '22 13:05 SpatzlHD

I haven't actually used the new MFA support in Riot Games yet. So I'm happy for you to PR this if you want.

I'm assuming we would need to implement a CLI tool that can be used to obtain your auth token, since this would now require the user to input an MFA code of some description.

It would probably work something like this:

  • User runs CLI tool
  • User provides username/password
  • if multiple MFA options configured, user is asked to choose the MFA source (email/token generator/sms)
  • User is asked to provide the MFA code
  • CLI tool outputs the auth token
  • User can then use this auth token when creating a new instance of the Valorant API client

liamcottle avatar May 15 '22 06:05 liamcottle

How would it work when this package is used in a backend server, where user doesn't have access to the CLI ?

Drysque avatar May 15 '22 08:05 Drysque

Fortunately, Riot's only MFA method is a code via email. I had thought that the auth method simply returned a status that is either done or multifactor if the status is multifactor you can use a multifactor function that takes a code as a parameter. This then uses the session id stored from the normal auth function to perform the authentication. So the code on the user side would look something like this:


valorantApi.authorize('username', 'password').then((data) => {
    if(data.status === "multifactor"){
		valorantApi.multifactor('code').then(() => {
			//successful authentication
		})
	}else if(data.status === 'done'){
		//successful authentication
	}
}).catch((error) => {
    console.log(error);
});

SpatzlHD avatar May 16 '22 08:05 SpatzlHD

Any updates ?

Drysque avatar May 31 '22 11:05 Drysque

I am working on it but currently I am not at home and riot is making this shit hard

SpatzlHD avatar Jun 03 '22 13:06 SpatzlHD

Initial MFA support is now available for testing and feedback in the feature/mfa-support branch.

liamcottle avatar Jun 29 '22 08:06 liamcottle

Awesome ! Thanks a lot I'm going to try it out very soon

Drysque avatar Jun 29 '22 09:06 Drysque

Is there any progress on the MFA support?

yash1441 avatar Feb 20 '23 17:02 yash1441