Skip to content

Commit

Permalink
Merge pull request #268 from torusresearch/feat/email-code-flow
Browse files Browse the repository at this point in the history
support email code flow
  • Loading branch information
chaitanyapotti committed Oct 25, 2023
2 parents e4c0e54 + ec90bb8 commit 5cb0764
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion examples/vue-example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<select v-model="selectedLoginProvider" class="select">
<option :key="login" v-for="login in computedLoginProviders" :value="login">{{ login }}</option>
</select>
<select v-if="showEmailFlow" v-model="emailFlowType" class="select">
<option :key="flow" v-for="flow in Object.values(EMAIL_FLOW)" :value="flow">{{ flow }}</option>
</select>
<input
v-model="login_hint"
v-if="selectedLoginProvider === LOGIN_PROVIDER.EMAIL_PASSWORDLESS"
Expand Down Expand Up @@ -141,6 +144,11 @@ const OPENLOGIN_PROJECT_IDS: Record<OPENLOGIN_NETWORK_TYPE, string> = {
[OPENLOGIN_NETWORK.CELESTE]: "openlogin",
};

const EMAIL_FLOW = {
link: "link",
code: "code",
};

export default defineComponent({
name: "App",
data() {
Expand All @@ -158,7 +166,9 @@ export default defineComponent({
BUILD_ENV: BUILD_ENV,
selectedOpenloginNetwork: OPENLOGIN_NETWORK.SAPPHIRE_DEVNET as OPENLOGIN_NETWORK_TYPE,
useMpc: false,
selectedBuildEnv: BUILD_ENV.PRODUCTION
selectedBuildEnv: BUILD_ENV.PRODUCTION,
emailFlowType: EMAIL_FLOW.link,
EMAIL_FLOW: EMAIL_FLOW,
};
},
async created() {
Expand Down Expand Up @@ -206,6 +216,9 @@ export default defineComponent({
op.init();
return op;
},
showEmailFlow(): boolean {
return this.selectedLoginProvider === LOGIN_PROVIDER.EMAIL_PASSWORDLESS;
}
},
methods: {
async login() {
Expand Down Expand Up @@ -244,6 +257,13 @@ export default defineComponent({
};
}

if (this.emailFlowType) {
openLoginObj.extraLoginOptions = {
...openLoginObj.extraLoginOptions,
flow_type: this.emailFlowType,
};
}

console.log(openLoginObj, "OPENLOGIN");

Check warning on line 267 in examples/vue-example/src/App.vue

View workflow job for this annotation

GitHub Actions / test (20.x, ubuntu-latest)

Unexpected console statement
const data = await this.openloginInstance.login(openLoginObj);
if (data && data.privKey) {
Expand Down

0 comments on commit 5cb0764

Please sign in to comment.