Skip to main content

exchangeToken

@nmi-agro/fdm-source


@nmi-agro/fdm-source / fdm-rvo/src / exchangeToken

Function: exchangeToken()

exchangeToken(rvoClient, code): Promise<any>

Defined in: fdm-rvo/src/auth.ts:78

Exchanges an authorization code for an access token.

This function should be called in the callback route after the user returns from RVO.

Parameters

rvoClient

RvoClient

The initialized RvoClient instance.

code

string

The authorization code received in the query parameters of the callback URL.

Returns

Promise<any>

A promise that resolves to the accessToken string.

Throws

Will throw an error if the token exchange fails (e.g., invalid code, network error).