Giter VIP home page Giter VIP logo

feltex / login-demo Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 12 KB

Este repositório contém um projeto Spring Boot com Spring Security que implementa autenticação e autorização usando login via GitHub e Google. O objetivo deste projeto é fornecer um exemplo funcional de como integrar provedores de autenticação OAuth2 populares em uma aplicação Spring.

Home Page: https://www.youtube.com/feltexbr

Java 100.00%
java spring-boot spring-security github google java-21 java21 springboot

login-demo's Introduction

Spring Security Social Login

Vídeo: https://youtu.be/Uc8mPuaNGqM

Github login

  1. Acesse https://github.com/settings/profile
  2. Clique em "Developer settings"
  3. Selecione "OAuth Apps"
  4. Clique "New OAuth App"
  5. Preencha os campos
    1. Application Name: "feltex-springboot-auth2"
    2. Homepage URL: "http://localhost:8080"
    3. Authorization callback URL: "http://localhost:8080/login/oauth2/code/github"
    4. Clique "Register application"
    5. Clique em "generate a new client secret"
      1. Copie o código gerado d5d32c3c804ec8e20d6d7852f0ecc43af619821c
  6. Selecione sua aplicação
  7. Copie o Client Id/Secretd

https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps

Google Login

Selecione o seu projeto

OAuth consent screen

  1. Marque a opção "External"
  2. Preencha o nome da usa aplicação "App Name", "User Support email", "Developer Contact information"
  3. Clique em "Save and Continue".
  4. Clique em "ADD OR REMOVE SCOPES", selecione a primeira opcão
  5. "See your primary Google Account email address" e clique em Update.
  6. Em seguida: Save and Update
  7. Adicione usuarios de testes que poderem usar a aplicação [email protected] Clique em "add"
  8. Selecione "Save and Continue".
  9. Por fim confirme os dados no último passo e clique no botão para voltar ao Dashboard.

Criando as credenciais

  1. Selecione a opaćo "Credentials"
  2. Selecione Create Credentials
  3. Selecione "OAuth Client Id"
  4. Selectione Web Application
  5. Preencha os campos
    1. Application Type: Selectione Web Application
    2. Name: "My App"
    3. "Authorized JavaScript origins": http://localhost:8080
    4. "Authorized redirect URI": http://localhost:8080/login/oauth2/code/google
    5. Clique em "Create"
  6. Você terá a općao de fazer download das credenciais.
{
    "web":
    {
        "client_id": "66998749621-pu8bn2n96e0c1lpes563j6hfngpsqcl.apps.googleusercontent.com",
        "project_id": "hallowed-moment-684",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_secret": "745699541_pv8YPmiYTcMNNHtDNG4pffA_m",
        "redirect_uris":
        [
            "http://localhost:8080/login/oauth2/code/google"
        ],
        "javascript_origins":
        [
            "http://localhost:8080"
        ]
    }
}

login-demo's People

Contributors

andrefelixbr avatar feltex avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jeffssousa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.