-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ExWeiv/development
Helper Functions for Velo APIs and Integration + Docs Updated
- Loading branch information
Showing
69 changed files
with
2,608 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
# Easy Auth Setup | ||
|
||
Currently this documentation is in build. | ||
This package is built for developers and not for beginners instead it's more focusced for advanced users/developers. The goal of this package is give you ability to integrate popular OAuth options with your Wix website via Velo + JS. You'll find ready to use APIs to integrate OAuth apps with full customization or use few extra APIs for direct setup with less customization. | ||
|
||
You can read more about APIs in this docs. You can import OAuth options with their names like this: | ||
|
||
```js | ||
import { discord } from "@exweiv/easy-auth"; | ||
``` | ||
|
||
You can also import general OAuth helpers that's actually using Velo APIs like this: | ||
|
||
```js | ||
import { oauth } from "@exweiv/easy-auth"; | ||
``` | ||
|
||
`oauth` object will give you some functions to integrate oauth options with Wix Members quickly with less customization. If you want full customization you can build your own sing in and sign up process. | ||
|
||
--- | ||
|
||
**Read docs to understand functions and how to use them.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSessionToken = void 0; | ||
const errors_1 = require("../Errors/errors"); | ||
const wix_members_backend_1 = require("wix-members-backend"); | ||
const providers = __importStar(require("../index")); | ||
async function getSessionToken(provider, options, access_token) { | ||
try { | ||
const response = await providers[provider].authUser(options, undefined, access_token); | ||
const email = response.email; | ||
const sessionToken = await wix_members_backend_1.authentication.generateSessionToken(email); | ||
return sessionToken; | ||
} | ||
catch (err) { | ||
throw Error(`${errors_1.prefix} ${provider} - failed to login member with email.`); | ||
} | ||
} | ||
exports.getSessionToken = getSessionToken; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../../types/wix-members-backend.d.ts" /> | ||
/// <reference path="../../types/index.d.ts" /> | ||
|
||
import { prefix } from '../Errors/errors'; | ||
import { authentication } from 'wix-members-backend'; | ||
import { oauth } from '@exweiv/easy-auth'; | ||
import * as providers from '../index'; | ||
|
||
export async function getSessionToken(provider: oauth.OAuthProviders, options: oauth.OAuthOptions, access_token: string): Promise<string> { | ||
try { | ||
const response = await providers[provider].authUser(options, undefined, access_token); | ||
const email = response.email; | ||
const sessionToken = await authentication.generateSessionToken(email); | ||
return sessionToken; | ||
} catch (err) { | ||
throw Error(`${prefix} ${provider} - failed to login member with email.`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.