public class

ThirdPartyIdentity

extends GenericJson
java.lang.Object
   ↳ java.util.AbstractMap<K, V>
     ↳ com.google.api.client.util.GenericData
       ↳ com.google.api.client.json.GenericJson
         ↳ com.kinvey.java.auth.ThirdPartyIdentity

Class Overview

Used to provide credentials to Kinvey for authorization to a 3rd party authenticated user.

Use ThirdPartyIdentity#createThirdPartyIdentity(com.kinvey.java.auth.ThirdPartyIdentity.Type, String...) to create new instance.

This class is not thread safe.

Summary

Nested Classes
class ThirdPartyIdentity.MobileIdentityCredential  
enum ThirdPartyIdentity.Type  
Public Methods
static ThirdPartyIdentity createThirdPartyIdentity(ThirdPartyIdentity.Type type, String... params)
A factory method to use when constructor authentication provider and credential link objects that will be used by the Kinvey system.
[Expand]
Inherited Methods
From class com.google.api.client.json.GenericJson
From class com.google.api.client.util.GenericData
From class java.util.AbstractMap
From class java.lang.Object
From interface java.util.Map

Public Methods

public static ThirdPartyIdentity createThirdPartyIdentity (ThirdPartyIdentity.Type type, String... params)

A factory method to use when constructor authentication provider and credential link objects that will be used by the Kinvey system. This class follows the standard documented in the Kinvey REST API documentation.

There are four different types of identities to construct using this method. All of the objects returned can be used to obtain an authorization response from Kinvey.

Facebook:

 ThirdPartyIdentity facebook = ThirdPartyIdentity.createThirdPartyIdentity(ThirdPartyIdentity.Type.FACEBOOK, accessToken);
 KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,appKey,appSecret)
     .setThirdPartyAuthToken(facebook)
     .build()
     .execute();
 

Google:

 ThirdPartyIdentity google = ThirdPartyIdentity.createThirdPartyIdentity(ThirdPartyIdentity.Type.GOOGLE, accessToken);
 KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,appKey,appSecret)
     .setThirdPartyAuthToken(google)
     .build()
     .execute();
 

Twitter:

 ThirdPartyIdentity twitter = ThirdPartyIdentity.createThirdPartyIdentity(ThirdPartyIdentity.Type.TWITTER
          , accessToken
          , accessSecret
          , twitterConsumerKey
          , twitterConsumerSecret);
 KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,appKey,appSecret)
     .setThirdPartyAuthToken(twitter)
     .build()
     .execute();
 

LinkedIn:

 ThirdPartyIdentity linkedIn = ThirdPartyIdentity.createThirdPartyIdentity(ThirdPartyIdentity.Type.LINKED_IN
          , accessToken
          , accessSecret
          , linkedInConsumerKey
          , linkedInConsumerSecret);
 KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,appKey,appSecret)
     .setThirdPartyAuthToken(linkedIn)
     .build()
     .execute();

 

Auth Link:

 ThirdPartyIdentity authlinkIdentity = ThirdPartyIdentity.createThirdPartyIdentity(ThirdPartyIdentity.Type.AUTHLINK, accessToken, refreshToken);
 KinveyAuthResponse response = new KinveyAuthRequest.Builder(transport,jsonfactory,appKey,appSecret)
     .setThirdPartyAuthToken(authlinkIdentity)
     .build()
     .execute();
 

Parameters
type authentication provider that will be used to link the user
params the parameters passed in to construct the 3rd party provider credential
Returns
  • a thirdparty provider object used to associate a Kinvey user with a 3rd party auth provider