mirror of
https://github.com/Dan6erbond/sk-auth.git
synced 2025-04-18 01:17:01 +02:00
🚨 Fix some lint / formatter errors, ESLint plugin Svelte3 still not working
This commit is contained in:
parent
5e98d71122
commit
6d20f6e09b
@ -31,7 +31,7 @@ SvelteKitAuth also comes with first-class support for Typescript out of the box,
|
||||
|
||||
SvelteKitAuth is very easy to setup! All you need to do is instantiate the `SvelteKitAuth` class, and configure it with some default providers, as well as a JWT secret key used to verify the cookies:
|
||||
|
||||
_**Warning**: env variables prefixed with `VITE_` can be exposed and leaked into client-side bundles if they are referenced in any client-side code. Make sure this is not the case, or consider using an alternative method such as loading them via dotenv directly instead._
|
||||
_**Warning**: env variables prefixed with `VITE_` can be exposed and leaked into client-side bundles if they are referenced in any client-side code. Make sure this is not the case, or consider using an alternative method such as loading them via dotenv directly instead.\_
|
||||
|
||||
```ts
|
||||
export const appAuth = new SvelteKitAuth({
|
||||
|
@ -5,7 +5,7 @@
|
||||
"dev": "svelte-kit dev",
|
||||
"build": "svelte-kit build",
|
||||
"preview": "svelte-kit preview",
|
||||
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore --config .eslintrc.cjs .",
|
||||
"format": "prettier --write --plugin-search-dir=. ."
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -3441,12 +3441,6 @@ simple-swizzle@^0.2.2:
|
||||
cookie "^0.4.1"
|
||||
jsonwebtoken "^8.5.1"
|
||||
|
||||
"sk-auth@file:../":
|
||||
version "0.3.7"
|
||||
dependencies:
|
||||
cookie "^0.4.1"
|
||||
jsonwebtoken "^8.5.1"
|
||||
|
||||
slash@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { GetSession, RequestHandler } from "@sveltejs/kit";
|
||||
import type { EndpointOutput } from "@sveltejs/kit/types/endpoint";
|
||||
import { RequestHeaders } from '@sveltejs/kit/types/helper';
|
||||
import { ServerRequest } from '@sveltejs/kit/types/hooks';
|
||||
import { RequestHeaders } from "@sveltejs/kit/types/helper";
|
||||
import { ServerRequest } from "@sveltejs/kit/types/hooks";
|
||||
import cookie from "cookie";
|
||||
import * as jsonwebtoken from "jsonwebtoken";
|
||||
import type { JWT, Session } from "./interfaces";
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { EndpointOutput } from "@sveltejs/kit";
|
||||
import { ServerRequest } from '@sveltejs/kit/types/hooks';
|
||||
import { ServerRequest } from "@sveltejs/kit/types/hooks";
|
||||
import type { Auth } from "../auth";
|
||||
import type { CallbackResult } from "../types";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { EndpointOutput } from "@sveltejs/kit/types/endpoint";
|
||||
import { ServerRequest } from '@sveltejs/kit/types/hooks';
|
||||
import { ServerRequest } from "@sveltejs/kit/types/hooks";
|
||||
import type { Auth } from "../auth";
|
||||
import type { CallbackResult } from "../types";
|
||||
import { Provider, ProviderConfig } from "./base";
|
||||
@ -35,7 +35,9 @@ export abstract class OAuth2BaseProvider<
|
||||
|
||||
async signin(request: ServerRequest, auth: Auth): Promise<EndpointOutput> {
|
||||
const { method, url } = request;
|
||||
const state = [`redirect=${url.searchParams.get("redirect") ?? this.getUri(auth, "/", url.host)}`].join(",");
|
||||
const state = [
|
||||
`redirect=${url.searchParams.get("redirect") ?? this.getUri(auth, "/", url.host)}`,
|
||||
].join(",");
|
||||
const base64State = Buffer.from(state).toString("base64");
|
||||
const nonce = Math.round(Math.random() * 1000).toString(); // TODO: Generate random based on user values
|
||||
const authUrl = await this.getAuthorizationUrl(request, auth, base64State, nonce);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ServerRequest } from '@sveltejs/kit/types/hooks';
|
||||
import { ServerRequest } from "@sveltejs/kit/types/hooks";
|
||||
import type { Auth } from "../auth";
|
||||
import { ucFirst } from "../helpers";
|
||||
import { OAuth2BaseProvider, OAuth2BaseProviderConfig, OAuth2Tokens } from "./oauth2.base";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ServerRequest } from '@sveltejs/kit/types/hooks';
|
||||
import { ServerRequest } from "@sveltejs/kit/types/hooks";
|
||||
import type { Auth } from "../auth";
|
||||
import type { CallbackResult } from "../types";
|
||||
import { OAuth2BaseProvider, OAuth2BaseProviderConfig } from "./oauth2.base";
|
||||
|
Loading…
Reference in New Issue
Block a user