1.1.0 • Published 4 years ago

@landstorm/yggdrasil v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Yggdrasil

NPM GitHub package.json version

Minecraft 1.6 introduced a new authentication scheme called Yggdrasil which completely replaces the previous authentication system. Mojang's other game, Scrolls, uses this method of authentication as well. Mojang has said that this authentication system should be used by everyone for custom logins, but credentials should never be collected from users.

Using

Authenticate

Authenticates a user using their password.

const user = authenticate({
  agent:  {
	name:  'Minecraft',
	version:  1 // Can be increased
  },
  username:  'account@server.com', // e-mail if migrated
  password:  'password',
  requestUser:  true // required
})

Returns a response with the authentication data.

Signout

Invalidates acessToken using an account's username and password.

signout({
  username:  'account@server.com', // e-mail if migrated
  password:  'password',
})

Returns an empty payload if successful.

Refresh

Refreshes a valid accessToken.

refresh({
  acessToken: 'asdfsadfagd', // valid acess token
  clientToken: 'asdasdasfdasf', // valid client token
  selectedProfile: {
	id: 'aewawdas', // valid id,
	name: 'Bluserter_12323' // nick
  },
  requestUser: true // required, can be changed
})

Validate

Checks if an accessToken is usable for authentication with a Minecraft server.

validate({
  accessToken: 'asdfsafdsaf', // valid access token
  clientToken: 'adsfsadf4r53' // valid client token
})

Returns an empty payload 204 No Content if successful, an error JSON with status 403 Forbidden otherwise.

Invalidate

Invalidates accessToken using an account's username and password.

invalidate({
  accessToken: 'adsadsdasfd', // valid access token
  clientToken: '423983929123', // valid client token
})

Returns an empty payload if successful.

created by Landstorm.

References

Thanks to Wiki.vg. Node.JS TypeScript

1.1.0

4 years ago

1.0.0

4 years ago