# Examples

## Authenticating using a code

{% embed url="<https://github.com/PrismarineJS/prismarine-auth>" %}

{% tabs %}
{% tab title="Node (async)" %}

```javascript
const { dash } = require('@pyrondev/dash');
const { msaCodeAuthenticate } = require('@pyrondev/dash-auth');

(async () => {
	const DashAuth = await msaCodeAuthenticate('', './profiles', {
		flow: "msal",
		relyingParty: 'https://pocket.realms.minecraft.net/'
	});
	var Dash = new dash(dashAuth);
	var Realm = await new Dash.realm(12345678);
	var realmInfo = await Realm.info();
	console.log(realmInfo);
})();
```

{% endtab %}

{% tab title="Node" %}

{% endtab %}
{% endtabs %}

## Getting information about a specified realm

{% tabs %}
{% tab title="Node (async)" %}

```javascript
const { dash } = require('@pyrondev/dash');
const { comboAuthenticate } = require('@pyrondev/dash-auth');

(async () => {
	const DashAuth = await comboAuthenticate("EMAIL", "PASSWORD");
	var Dash = new dash(dashAuth);
	var Realm = await new Dash.realm(12345678);
	var realmInfo = await Realm.info();
	console.log(realmInfo);
})();
```

{% endtab %}

{% tab title="Node" %}

```javascript
```

{% endtab %}
{% endtabs %}

## Getting account realms

{% tabs %}
{% tab title="Node (async)" %}

```javascript
const { dash } = require('@pyrondev/dash');
const { comboAuthenticate } = require('@pyrondev/dash-auth');

(async () => {
	const DashAuth = await comboAuthenticate("EMAIL", "PASSWORD");
	var Dash = new dash(dashAuth);
	var Client = await Dash.client();
	var realms = await Client.realms();
	console.log(realms);
})();
```

{% endtab %}

{% tab title="Node" %}

```javascript
```

{% endtab %}
{% endtabs %}
