{"id":24540020,"url":"https://github.com/spurtcms/auth","last_synced_at":"2025-10-09T15:34:54.033Z","repository":{"id":231506966,"uuid":"781820414","full_name":"spurtcms/auth","owner":"spurtcms","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-30T12:00:49.000Z","size":70,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-08-04T09:22:20.800Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spurtcms.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license","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-04-04T05:20:42.000Z","updated_at":"2024-08-07T16:40:59.470Z","dependencies_parsed_at":"2024-08-07T16:51:00.735Z","dependency_job_id":null,"html_url":"https://github.com/spurtcms/auth","commit_stats":null,"previous_names":["spurtcms/auth"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spurtcms%2Fauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spurtcms","download_url":"https://codeload.github.com/spurtcms/auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826778,"owners_count":20354220,"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":[],"created_at":"2025-01-22T17:17:57.871Z","updated_at":"2025-10-09T15:34:48.990Z","avatar_url":"https://github.com/spurtcms.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auth Package\n\nThis Auth package stands as a versatile, standalone module, tailored for seamless integration into any Golang project, promising flexibility and convenience. It isn't confined solely to any particular platform; it offers full freedom to incorporate it into any Golang platform. We have seamlessly integrated it with the spurtCMS admin system, ensuring a smooth integration process.\n\n## Features\n\n- Smooth admin login \n- Generates and returns an authentication token, typically used for user authentication and authorization processes.\n- Validates the authenticity and integrity of a given authentication token.\n- Check if a user login attempt is valid by verifying credentials against stored user information.\n- Parses and decrypts JWT tokens (Json Web Tokens) from the HTTP request's 'authorization' header\n- Verifies the validity of tokens using the provided jwtSecret\n\n\n# Installation\n\n``` bash\ngo get github.com/spurtcms/auth\n```\n\n\n- Setup the Auth config\n``` bash\nconfig := Config{\n\t\tUserId:     1,\n\t\tExpiryTime: 2, // It should be in hours not minutes or seconds\n\t\tSecretKey:  \"test@123\",\n\t\tDB:         \u0026gorm.DB{},\n\t}\n\n\tauth := AuthSetup(config)\n```\n\n\n# Usage Example\n``` bash\nfunc main (){\n\n\t\tconfig := Config{\n\t\t\tUserId:     1,\n\t\t\tExpiryTime: 2, // It should be in hours not minutes or seconds\n\t\t\tSecretKey:  \"test@123\",\n\t\t\tDB:         \u0026gorm.DB{},\n\t\t}\n\t\t\n\t\tauth := AuthSetup(config)\n\t\t\n\t\t//create token - generates new  JWtoken\n\t\ttoken, _ := auth.CreateToken()\n\t\t\n\t\t//checklogin - verifies user credentials\n\t\ttoken, userid,err :=auth.Checklogin(\"Username\", \"Password\")\n\t\t\n\t\t//verifytoken - parses and verifies the token generated\n\t\tuserid, err :=\tauth.VerifyToken(\"token\",\"secretkey\",\"currenttime\")\n\t}\n```\n\n# Getting help\nIf you encounter a problem with the package,please refer [Please refer (https://www.spurtcms.com/documentation/cms-admin) or you can create a new Issue in this repo (https://github.com/spurtcms/auth/issues). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspurtcms%2Fauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspurtcms%2Fauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspurtcms%2Fauth/lists"}