Coder Social home page Coder Social logo

spring-social-qq's Introduction

##Config:

The config can be done by spring boot autoconfig.

U only need to impl & register SignInAdapter to context to perform signin after oauth check

##Usage:

  1. Add maven depency into your project

     <dependency>
     	<groupId>net.gplatform</groupId>
     	<artifactId>spring-social-qq</artifactId>
     	<version>1.0.2</version>
     </dependency>
    
  2. Config appId & appSecret

    • Copy qqconnectconfig.properties to your project classpath & change app_ID & app_KEY to the value you retrieved from Tencent Note: This is used by QQ SDK.

    • Also add above value under key spring.social.qq.appId & spring.social.qq.appSecret in application.properties Note: This is used by spring boot

  3. Implement SignInAdapter Code Example:

     @Component
     public class MySignInAdapter implements SignInAdapter {
     	@Override
     	public String signIn(String localUserId, Connection<?> connection, NativeWebRequest request) {
     		LoginUtil.signin(localUserId, null);
     		
     		String goToURL = "/home"
     		return goToURL;
     	}
     }
    
  4. Add QQ login button in your page

    Code Example:

     <form method="POST" action="/yourAppName/signin/qq">
     	<input type="hidden" name="scope" value="get_user_info,add_topic,add_one_blog,add_album,upload_pic,list_album,add_share,check_page_fans,add_t,add_pic_t,del_t,get_repost_list,get_info,get_other_info,get_fanslist,get_idollist,add_idol,del_ido,get_tenpay_addr">
     	<div class="row" style="margin-left: 10px;">
     		<button type="submit">
     			Login With QQ
     		</button>
     	</div>
     </form>
    

    Note: You need to replace yourAppName with correct value. For supported scope value, please refer to Open QQ specification in http://open.qq.com/

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.