{"id":30592994,"url":"https://github.com/rogelioolarte/auth-alpaca","last_synced_at":"2026-03-03T23:31:40.467Z","repository":{"id":274292036,"uuid":"922423824","full_name":"rogelioolarte/auth-alpaca","owner":"rogelioolarte","description":"Spring Boot App that focuses on implementing multiple authentication methods using OAuhth2 and JWT.","archived":false,"fork":false,"pushed_at":"2026-02-16T04:15:40.000Z","size":1542,"stargazers_count":10,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-02-16T11:50:14.148Z","etag":null,"topics":["jwt","multiple-authentication","oauth2","register-login","security","spring","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","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/rogelioolarte.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-26T06:48:16.000Z","updated_at":"2025-11-29T13:19:46.000Z","dependencies_parsed_at":"2025-02-11T23:23:07.026Z","dependency_job_id":"d0b07e79-010b-4c16-bcf9-01bbe23d69fa","html_url":"https://github.com/rogelioolarte/auth-alpaca","commit_stats":null,"previous_names":["rogelioolarte/multiple-auth-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rogelioolarte/auth-alpaca","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogelioolarte%2Fauth-alpaca","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogelioolarte%2Fauth-alpaca/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogelioolarte%2Fauth-alpaca/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogelioolarte%2Fauth-alpaca/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rogelioolarte","download_url":"https://codeload.github.com/rogelioolarte/auth-alpaca/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogelioolarte%2Fauth-alpaca/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30065783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["jwt","multiple-authentication","oauth2","register-login","security","spring","spring-boot"],"created_at":"2025-08-29T18:04:11.138Z","updated_at":"2026-03-03T23:31:40.422Z","avatar_url":"https://github.com/rogelioolarte.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auth Alpaca\n\n[![javadoc badge]][javadoc]\n[![release badge]][release]\n[![codecov badge]][codecov]\n[![license badge]][license]\n\n[javadoc]: https://rogelioolarte.github.io/auth-alpaca/\n[javadoc badge]: https://img.shields.io/github/v/release/rogelioolarte/auth-alpaca?label=javadoc\u0026labelColor=grey\u0026color=brightgreen\n[release]: https://github.com/rogelioolarte/auth-alpaca/releases\n[release badge]: https://img.shields.io/github/v/release/rogelioolarte/auth-alpaca?color=brightgreen\u0026sort=semver\n[codecov]: https://codecov.io/gh/rogelioolarte/auth-alpaca\n[codecov badge]: https://codecov.io/gh/rogelioolarte/auth-alpaca/branch/main/graph/badge.svg\n[license]: LICENSE\n[license badge]: https://img.shields.io/github/license/rogelioolarte/auth-alpaca?color=blue\n\n- [Auth Alpaca](#auth-alpaca)\n  - [What is Auth Alpaca?](#what-is-auth-alpaca)\n  - [Introduction to the project](#introduction-to-the-project)\n  - [Dependencies](#dependencies)\n  - [How it works the process of login with OAuth2?](#how-it-works-the-process-of-login-with-oauth2)\n- [Before to start to run the applications](#before-to-start-to-run-the-applications)\n- [1. **Start up the database and environment variables:**](#1-start-up-the-database-and-environment-variables)\n- [2. **Start up the auth-alpaca (Backend):**](#2-start-up-the-auth-alpaca-backend)\n- [3. **Start up the auth-alpaca-ui (Frontend):**](#3-start-up-the-auth-alpaca-ui-frontend)\n- [Are you curious about the Development Process?](#are-you-curious-about-the-development-process)\n- [Are you curious about OAuth2 Process?](#are-you-curious-about-oauth2-process)\n\n## What is Auth Alpaca?\nSpring Boot Application that focuses on implementing multiple authentication methods using OAuhth2 and JWT.\n\n## Introduction to the project\nThe repository contains a Springboot application for users to **login and register** using email and password or using OAuth2 (Google).\nThe backend app is meant to be run together with the frontend Angular application.\n\n## Dependencies \n  * Backend:\n    * Java 21\n    * Spring Boot 3.4\n    * PostgreSQL\n    * [JJWT 0.12.6](https://github.com/jwtk/jjwt)\n  * Frontend:\n    * Angular 18\n    * [JWT-Decode](https://github.com/auth0/jwt-decode)\n\n## How it works the process of login with OAuth2? \n\u003cdetails\u003e\n  \u003cul\u003e\n    \u003cli\u003eFirst, The user visits our Frontend application and logs in with \"Google\" and is redirected to our Backend application where he is then redirected to the Google consent page with our OAuth2 API information for Google\u003c/li\u003e\n    \u003cli\u003eSecond, If he accepts the consent, he is redirected to our Backend application with the authorization code, where it is resolved, where he will first be redirected to our Backend application, but at the end to our Frontend application.\u003c/li\u003e\n    \u003cli\u003eThird, The received authorization code is processed and resolved in our Backend application, then the received authorization code is exchanged for a Token.\u003c/li\u003e\n    \u003cli\u003eFourth, The Token response is received by our Backend application and converted to a Token response with our JWT configuration, then he is redirected to our Frontend application with the new Token.\u003c/li\u003e\n    \u003cli\u003eFifth, The user can access our Backend application to use any of our services.\u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/details\u003e\n\u003cdiv align=\"center\" \u003e\n  \u003cimg src=\"ouath2-diagram.png\" alt=\"google oauth2 diagram\"\u003e\n\u003c/div\u003e\n\u003ca href=\"https://developers.google.com/identity/protocols/oauth2\" target=\"_blank\" \u003eSource\u003c/a\u003e - \n\u003ca href=\"https://developers.google.com/static/identity/protocols/oauth2/images/flows/authorization-code.png\" target=\"_blank\" \u003eBase Image Source\u003c/a\u003e\n\n# Before to start to run the applications\n - **Note: Use a terminal with bash to run the scripts.**\n\n# 1. **Start up the database and environment variables:**\n 1. Run the following script to create the security variables:\n \n```console\nbash backend/generate_keys.sh\n```\n\n 2. Create your credentials for using oauth2 in the google cloud console or follow the steps detailed [here](https://blog.devgenius.io/part-3-implementing-authentication-with-spring-boot-security-6-oauth2-and-angular-17-via-8716646ed062).\n\n  3. Run Postgresql docker container with the following command (replace _{PASSWORD}_ with your own password):\n\n```console\ndocker run --name auth-alpaca-app-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD={PASSWORD}  -e POSTGRES_DB=auth-alpaca -d -p 127.0.0.1:5432:5432 postgres\n```\n\n - Don't change the port configuration when running in a local environment. The syntax of the mapping is for extra security, so that the database is not accessible from outside the container.\n\n - If you change the password to the postgresql database, make sure to update the password in the application.properties file of the **_auth-alpaca-api_** project.\n - If you need to connect to the postgresql database container, run the following command:\n\n```console\ndocker exec -it auth-alpaca-app-postgres bash\n```\n\n - Connect to postgresql database, once inside the container:\n```console\npsql -U postgres\n```\n\n# 2. **Start up the auth-alpaca (Backend):**\n  - Note: Currently, [dotenv-java](https://github.com/cdimascio/dotenv-java) is used to load environment variables. Please note that this library should not be used in a production environment.\n  \n  1. Make sure to create a _.env_ file in the root of the project, and list all the required properties there as key-value pairs (don't forget to exclude this file from version control):\n\n```\n SPRING_DATASOURCE_USERNAME=postgres\n SPRING_DATASOURCE_PASSWORD=K29r8Dhc79n2gPG86CRhoVt9NBxTa0Gk\n ......\n```\n\n 2. Run the following command from the root directory of the project or just press the start button in your IDE:\n\n```bash\n./mvnw spring-boot:run\n```\n\n  - Default port for the _auth-alpaca-api_ is 8080. If you want to change the port, set the \"server.port\" property in the _application.properties_ file. If you change the port, make sure to update the port in the auth-alpaca-ui project as well (_constants.ts_ file, \"API_BASE_URL\" parameter).\n  \n - As this project uses OAuth2, make sure to update the redirect-uri in the _application.properties_ file and in configurations at OAuth2 providers (Google, GitHub, Twitter, etc.) too.\n  \n - If you checked out from _main_ branch, you will see that _application.properties_ contains references to environment variables.\n\n# 3. **Start up the auth-alpaca-ui (Frontend):**\n  1. Run the following command from the root directory of the project:\n\n```console\nnpm install\n```\n  2. Run the following command from the root directory of the project:\n\n```console\nnpm run start\n```\n\n  - Default port for the auth-alpaca-ui is 4200. If you want to change the port, update the port in the angular.json file. On the following path: _auth-alpaca-ui -\u003e architect -\u003e serve_ add this:\n  \n```\n\"options\": {\n  \"port\": [desired-port]\n}\n```\n\n  - Make sure to update authorized redirect uri usage places in the _auth-alpaca-api_ too.\n\n# Are you curious about the Development Process? \nThe Use of OAuth2 has been implemented according to the following repository, if you find this project useful, please visit the following repository and follow the step-by-step creation articles [here](https://blog.devgenius.io/part-4-implementing-authentication-with-spring-boot-security-6-oauth2-and-angular-17-via-df3fbb003946).\nYou can find the corresponding repository [here](https://github.com/anitalakhadze/auth-alpaca-ui).\n\n# Are you curious about OAuth2 Process?\nVisit the documentation and explanation of Google OAuth2 [here](https://developers.google.com/identity/protocols/oauth2).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogelioolarte%2Fauth-alpaca","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogelioolarte%2Fauth-alpaca","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogelioolarte%2Fauth-alpaca/lists"}