{"id":20692162,"url":"https://github.com/developerjosh/blues-auth-lib","last_synced_at":"2026-04-24T14:03:00.457Z","repository":{"id":253000278,"uuid":"842152855","full_name":"DeveloperJosh/Blues-auth-lib","owner":"DeveloperJosh","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-13T19:33:51.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T01:37:01.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/DeveloperJosh.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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":"2024-08-13T19:24:51.000Z","updated_at":"2024-08-13T19:33:54.000Z","dependencies_parsed_at":"2024-08-13T22:58:25.468Z","dependency_job_id":null,"html_url":"https://github.com/DeveloperJosh/Blues-auth-lib","commit_stats":null,"previous_names":["developerjosh/blues-auth-lib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DeveloperJosh/Blues-auth-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperJosh%2FBlues-auth-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperJosh%2FBlues-auth-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperJosh%2FBlues-auth-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperJosh%2FBlues-auth-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeveloperJosh","download_url":"https://codeload.github.com/DeveloperJosh/Blues-auth-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperJosh%2FBlues-auth-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32226408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-16T23:19:35.940Z","updated_at":"2026-04-24T14:03:00.421Z","avatar_url":"https://github.com/DeveloperJosh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSOClient Documentation\n\nThis class facilitates Single Sign-On (SSO) integration, handling login URL generation, callback processing, user data fetching, and token saving.\n\n## Dependencies\n\n* axios: Handles HTTP requests.\n* dotenv: Loads environment variables from a `.env` file.\n\n## Installation \n\n* Assumes you have Node.js and npm installed. \n* You'll need to install the required dependencies using a package manager like npm.\n\n## Usage\n\n* Import the `SSOClient` class into your project.\n* Load your environment variables (clientId, clientSecret, ssoUrl, callbackUrl) from a `.env` file.\n* Create an instance of the `SSOClient` class, providing the necessary configuration options.\n* Use the `getLoginUrl` method to get the URL to initiate the SSO login process.\n* Handle the callback after the SSO login (e.g., in an Express route) using the `handleCallback` method to extract the token.\n* Fetch user data using the `fetchUserData` method, providing the extracted token.\n* Render a page to save the token in local storage using the `renderSaveTokenPage` method.\n\n## Class: `SSOClient`\n\n### Constructor\n\n* **`clientId`**: Your application's client ID from the SSO provider.\n* **`clientSecret`**: Your application's client secret from the SSO provider.\n* **`ssoUrl`**: The base URL of the SSO provider.\n* **`callbackUrl`**: The URL in your application where the SSO provider will redirect after login.\n\n### Methods\n\n* **`getLoginUrl()`**: Returns the URL to initiate the SSO login process.\n* **`handleCallback(query)`**: Extracts the token from the callback query parameters. Throws an error if no token is found.\n* **`fetchUserData(token)`**: Fetches user data from the SSO provider's API using the provided token. Returns a Promise that resolves with the user data or rejects with an error.\n* **`renderSaveTokenPage(token)`**: Generates an HTML page that saves the token in local storage and redirects to the root path ('/').\n\n## Important Notes\n\n* Ensure you have a `.env` file with the required environment variables.\n* Handle potential errors from `handleCallback` and `fetchUserData`.\n* Customize the `renderSaveTokenPage` as needed for your application's flow.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperjosh%2Fblues-auth-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloperjosh%2Fblues-auth-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperjosh%2Fblues-auth-lib/lists"}