TypeScript SDK
Use the Arc SDK on your trusted launcher or backend to create an authentication session for a player.
Install
npm install arc-servicesCreate an authentication session
The SDK defaults to the production stage. Set the stage explicitly while working against development or staging services.
import * as arc from "arc-services";
const config: arc.Configuration = {
ClientID: process.env.ARC_CLIENT_ID!,
stage: "dev",
};
const instance = new arc.Instance(config);
const identity = instance.CreateIdentity(
"MyGame",
accountId,
displayName,
);
const session = await instance.CreateAuthSession(identity);
const arcToken = session.auth.token;Session result
The response includes the Arc account and an authentication object. Pass session.auth.token to the Arc process as -t=<token>.
interface Session {
account: {
display_name: string;
country: string;
active: boolean;
};
auth: {
clid: string;
token: string;
};
}