@iterout/0auth-module
v1.0.4
Published
0auth module for backend application
Downloads
1
Readme
0auth-module
0auth module for backend application
Installation
npm install @iterout/0auth-module
Configuration
Create GOOGLE_CLIENT_ID
from google cloud console.
import { oAuthConfiguration } from "@iterout/0auth-module";
oAuthConfiguration.setGoogleClientId([GOOGLE_CLIENT_ID]);
SignIn
Google signin with @iterout/auth-module
integration.
User already registered: login.
New user: registration and login.
import { googleSignIn } from "@iterout/0auth-module";
const tokens: TokenData = await googleSignIn(
googleToken: string,
userType: string,
userRoles: string[]
);
Client side integration
Vue.js
<template>
<div>
<!-- google sign in -->
<div
id="g_id_onload"
data-client_id="[GOOGLE_CLIENT_ID]"
data-login_uri="[BACKEND_ENDPOINT]"
data-auto_prompt="false"
></div>
<div
class="g_id_signin"
data-type="standard"
data-size="large"
data-theme="outline"
data-text="sign_in_with"
data-shape="rectangular"
data-logo_alignment="left"
></div>
</div>
</template>
<script setup>
onMounted(() => {
const googleSignInScript = document.createElement("script");
googleSignInScript.setAttribute(
"src",
"https://accounts.google.com/gsi/client"
);
document.head.appendChild(googleSignInScript);
});
</script>