Skip to content

RubikClub/Spring-Boot-Oauth2-Starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rubik

Spring Boot Oauth2

License Slack

About Project

This Project Spring Boot Oauth2 is a starter template that will guide you to configure your own social logins for individual projects.

This project is an open source initiative launched by Rubik Club 😊 in order to maintain a standarized Dev Community ❤️ within its members.

If you are a huge nerd like us help us to help you by contributing to this awesome adventure.

Show us you're capabilities 💪 and the spread message about our journey!!!

Tech Stack

This projects backend is is fully powered with the awesome 😎 Spring Boot and we are using our favorite frontend framework React for client side.

Current Progress

Right now we have successfully added social logins for Google, FaceBook, and GitHub. If you like to tackle other platforms feel free to add them to the project.

How to setup

Clone the project using

git clone

Run the REST API via

mvn spring-boot:run

Run the Client via

cd client && npm start

Now, find 🪲 and create issues so we can help you 😁.

Guidelines

We are modularizing our project for the ease of management. When you first init the project don't forget to add the necessary CLIENT IDs and CLIENT SECRETs to the application.yml file below.

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/spring_social?useSSL=false
    username: demouser
    password: demouser

  jpa:
    show-sql: true
    hibernate:
      ddl-auto: update
      naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
    properties:
      hibernate:
        dialect: org.hibernate.dialect.MySQL5InnoDBDialect
  security:
    oauth2:
      client:
        registration:
          google:
            clientId: [YOUR_GOOGLE_CLIENT_ID]
            clientSecret: [YOUR_GOOGLE_CLIENT_SECRET]
            redirectUriTemplate: "{baseUrl}/oauth2/callback/{registrationId}"
            scope:
            - email
            - profile
          facebook:
            clientId: [YOUR_FACEBOOK_CLIENT_ID]
            clientSecret: [YOUR_FACEBOOK_CLIENT_SECRET]
            redirectUriTemplate: "{baseUrl}/oauth2/callback/{registrationId}"
            scope:
            - email
            - public_profile
          github:
            clientId: [YOUR_GITHUB_CLIENT_ID]
            clientSecret: [YOUR_GITHUB_CLIENT_SECRET]
            redirectUriTemplate: "{baseUrl}/oauth2/callback/{registrationId}"
            scope:
            - user:email
            - read:user
        provider:
          facebook:
            authorizationUri: https://www.facebook.com/v3.0/dialog/oauth
            tokenUri: https://graph.facebook.com/v3.0/oauth/access_token
            userInfoUri: https://graph.facebook.com/v3.0/me?fields=id,first_name,middle_name,last_name,name,email,verified,is_verified,picture.width(250).height(250)
app:
  auth:
    tokenSecret: 926D96C90030DD58429D2751AC1BDBBC
    tokenExpirationMsec: 864000000
  oauth2:    
    authorizedRedirectUris:
    - http://localhost:3000/oauth2/redirect
    - myandroidapp://oauth2/redirect
    - myiosapp://oauth2/redirect