Skip to content

Instantly share code, notes, and snippets.

@janniks
Created March 25, 2022 12:43
Show Gist options
  • Save janniks/d62c4ceb77fab628d797504e466d274d to your computer and use it in GitHub Desktop.
Save janniks/d62c4ceb77fab628d797504e466d274d to your computer and use it in GitHub Desktop.
authenticate — Stacks Authentication
import { AppConfig, UserSession, showConnect } from "@stacks/connect";
const appConfig = new AppConfig(["store_write", "publish_data"]);
const userSession = new UserSession({ appConfig });
function authenticate() {
showConnect({
appDetails: {
name: "My App",
icon: window.location.origin + "/my-app-logo.svg",
},
redirectTo: "/",
onFinish: () => {
let userData = userSession.loadUserData();
// Save or otherwise utilize userData post-authentication
},
userSession: userSession,
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment