private String buildAuthorisationCredential ( final Query < ? , ? > query ) { String credential = null ; if ( query instanceof OAuthQuery ) { final String oauthToken = ( ( OAuthQuery ) query ) . getOauthToken ( ) ; credential = String . format ( "Bearer %s" , oauthToken ) ; } else if ( query instanceof AccessTokenQuery ) { // Don't set the Authorization header } else { credential = String . format ( "Token %s" , clientSecret ) ; } return credential ; }
Build the credential that will be passed in the Authorization HTTP header as part of the API call . The nature of the credential will depend on the query being made .