Auth
Last updated
Was this helpful?
Was this helpful?
import { useOAuthLogin } from "@carto/react-auth";
const oauthApp = {
clientId: "YOUR_OAUTH_CLIENT_ID",
scopes: ["user:profile"],
authorizeEndPoint: "https://carto.com/oauth2/authorize",
};
const onParamsRefreshed = (oauthParams) => {
if (oauthParams.error) {
console.error(`OAuth error: ${oauthParams.error}`);
} else {
console.log(oauthParams);
}
};
const [handleLogin] = useOAuthLogin(oauthApp, onParamsRefreshed);
// handleLogin function should be later handled from UI to trigger the flow