{"id":20196311,"url":"https://github.com/authorizerdev/authorizer-svelte","last_synced_at":"2025-04-10T10:43:02.656Z","repository":{"id":59078790,"uuid":"534524702","full_name":"authorizerdev/authorizer-svelte","owner":"authorizerdev","description":"Svelte SDK for [authorizer.dev](https://authorizer.dev/)","archived":false,"fork":false,"pushed_at":"2023-12-05T17:23:05.000Z","size":569,"stargazers_count":9,"open_issues_count":2,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T09:38:23.771Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/authorizerdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-09T06:25:33.000Z","updated_at":"2024-11-03T01:04:04.000Z","dependencies_parsed_at":"2023-01-22T14:30:55.433Z","dependency_job_id":"256e7c04-6c0f-49cb-9857-ebe68cf1bdf9","html_url":"https://github.com/authorizerdev/authorizer-svelte","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-svelte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-svelte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-svelte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authorizerdev%2Fauthorizer-svelte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authorizerdev","download_url":"https://codeload.github.com/authorizerdev/authorizer-svelte/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199988,"owners_count":21063800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-14T04:23:12.692Z","updated_at":"2025-04-10T10:43:02.641Z","avatar_url":"https://github.com/authorizerdev.png","language":"Svelte","funding_links":["https://github.com/sponsors/authorizerdev"],"categories":[],"sub_categories":[],"readme":"# authorizer-svelte\n\nSvelte SDK for [authorizer.dev](https://authorizer.dev) integration in your [svelte-js](https://svelte.dev/) application. This will allow you to have authentication and authorization ready in minutes.\n\nFor detailed information about all the components check [docs](https://docs.authorizer.dev/authorizer-svelte)\n\n## Getting Started\n\nHere is a quick guide on getting started with `@authorizerdev/authorizer-svelte` package.\n\n### Step 1 - Create Instance\n\nGet Authorizer URL by instantiating [Authorizer instance](/deployment) and configuring it with necessary [environment variables](/core/env).\n\n### Step 2 - Install package\n\nAssuming you have svelte-js application up and running, install following package in your application\n\n```sh\nnpm i --save @authorizerdev/authorizer-svelte\nOR\nyarn add @authorizerdev/authorizer-svelte\n```\n\n### Step 3 - Configure Provider and use Authorizer Component\n\nAuthorizer comes with global context `authorizerContext` which is available once you have configured `AuthorizerProvider` component.\n\nConfigure `AuthorizerProvider` at root level in your application and import `default.css`.\n\n\u003e Note: You can override default style with `css` variables. Check [docs](https://docs.authorizer.dev/authorizer-svelte) for more details.\n\n`eg: routes/+layout.svelte`\n\n```svelte\n\u003cscript\u003e\n\timport { AuthorizerProvider } from '@authorizerdev/authorizer-svelte';\n\timport '@authorizerdev/authorizer-svelte/styles/default.css';\n\u003c/script\u003e\n\n\u003cAuthorizerProvider\n    config={{\n        authorizerURL: `YOUR_AUTHORIZER_INSTANCE_URL`\n        redirectURL: typeof window != 'undefined' ? window.location.origin : ``\n        client_id: 'YOUR_CLIENT_ID'\n    }}\n\u003e\n    \u003cslot /\u003e\n\u003c/AuthorizerProvider\u003e\n```\n\n**Use `Authorizer` Component**\n\n`eg: routes/+page.svelte`\n\n```svelte\n\u003cscript\u003e\n\timport { getContext } from 'svelte';\n\timport { Authorizer } from '@authorizerdev/authorizer-svelte';\n\n\t/**\n\t * @type {{ token: string; user: any; loading: boolean; logout: Function; }}\n\t */\n\tlet state;\n\n\tconst store = getContext('authorizerContext');\n\n\tstore.subscribe((/** @type {any} */ data) =\u003e {\n\t\tstate = data;\n\t});\n\n\tconst logoutHandler = async () =\u003e {\n\t\tawait state.logout();\n\t};\n\u003c/script\u003e\n\n{#if state.user}\n\t\u003cdiv\u003e\n\t\t\u003ch1\u003eHey 👋,\u003c/h1\u003e\n\t\t\u003cspan\u003e{state.user.email}\u003c/span\u003e\n\t\t\u003cbr /\u003e\n\t\t{#if state.loading}\n\t\t\t\u003ch3\u003eProcessing....\u003c/h3\u003e\n\t\t{:else}\n\t\t\t\u003ch3 style=\"color: #3B82F6; cursor: pointer;\" on:click={logoutHandler}\u003eLogout\u003c/h3\u003e\n\t\t{/if}\n\t\u003c/div\u003e\n{:else}\n\t\u003cdiv class=\"login-container\"\u003e\n\t\t\u003ch1\u003eWelcome to Authorizer\u003c/h1\u003e\n\t\t\u003cbr /\u003e\n\t\t\u003cAuthorizer /\u003e\n\t\u003c/div\u003e\n{/if}\n```\n\n## Support our work\n\nGithub Sponsorship: https://github.com/sponsors/authorizerdev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthorizerdev%2Fauthorizer-svelte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthorizerdev%2Fauthorizer-svelte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthorizerdev%2Fauthorizer-svelte/lists"}