UNPKG

valorant-api-types

Version:

A collection of documented endpoints and return types for the unofficial Valorant API

65 lines 3.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.authRequestEndpoint = void 0; const zod_1 = require("zod"); exports.authRequestEndpoint = { name: 'Auth Request', description: [ 'Perform authorization request to get token', '', 'Requires cookies from the [POST Auth Cookies] stage. If the user has multi-factor authentication enabled, the response will contain a `type` of `multifactor` and [PUT Multi-Factor Authentication] will need to be used.', '', 'Note: ', 'Authenticating directly is prone to breakage (captchas and cloudflare anti-bot) and does not support users who use alternative sign-in methods.', 'Consider using [GET Cookie Reauth] or opening a webview to the Riot login page and watching for redirects.', '', 'For an example of watching redirects in a webview (using Electron), see [insomnia-plugin-valorant](https://github.com/techchrism/insomnia-plugin-valorant/blob/a8f1db24cacf934d49e7b562b2265c76a8fabdf4/src/util/auth/open-webview-popup.ts)' ].join('\n'), category: 'Authentication Endpoints', type: 'other', suffix: 'https://auth.riotgames.com/api/v1/authorization', method: 'PUT', headers: new Map([ ['Content-Type', 'application/json'], ]), body: zod_1.z.object({ type: zod_1.z.literal('auth'), language: zod_1.z.literal('en_US'), remember: zod_1.z.boolean(), riot_identity: zod_1.z.object({ captcha: zod_1.z.string().describe('hcaptcha token from the login page (see <https://docs.hcaptcha.com/>)'), username: zod_1.z.string(), password: zod_1.z.string() }) }), responses: { '200': zod_1.z.discriminatedUnion('type', [ zod_1.z.object({ type: zod_1.z.literal('success'), success: zod_1.z.object({ login_token: zod_1.z.string(), redirect_url: zod_1.z.string(), is_console_link_session: zod_1.z.boolean(), auth_method: zod_1.z.literal('riot_identity'), puuid: zod_1.z.string() }), country: zod_1.z.string(), platform: zod_1.z.string(), }), zod_1.z.object({ type: zod_1.z.literal('multifactor'), multifactor: zod_1.z.object({ method: zod_1.z.literal('email'), methods: zod_1.z.array(zod_1.z.literal('email')), email: zod_1.z.string().describe('partially-obscured email address'), mode: zod_1.z.literal('auth'), auth_method: zod_1.z.literal('riot_identity') }), country: zod_1.z.string(), platform: zod_1.z.string(), error: zod_1.z.literal('invalid_code').optional().describe('The MFA request seems to still give an HTTP response code of 200 for invalid codes but attaches this error property') }) ]) } }; //# sourceMappingURL=AuthRequest.js.map