Package org.scribe.model

Examples of org.scribe.model.Token


    LocalOAuthTokenCacheService oAuthTokenCacheService;

    @Before
    public void setUp() throws Exception {
        oAuthTokenCacheService = new LocalOAuthTokenCacheService();
        Token testToken = new Token("access","secret");
        oAuthTokenCacheService.cacheToken(testToken);
    }
View Full Code Here


    /**
     * Converts this OAuthRequestToken model object to a Scribe Token.
     * @return a Scribe Token object with the same token and secret as kept in this model.
     */
    public Token toScribeToken() {
        return new Token(oauthToken, oauthTokenSecret);
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public String getAuthorizationUrl() {
        OAuthService oAuthService = getOAuthService();
        Token requestToken = oAuthService.getRequestToken();
        String authorizationUrl = oAuthService.getAuthorizationUrl(requestToken);
        cacheService.cacheToken(requestToken);
        return authorizationUrl;
    }
View Full Code Here

        tokenCache.invalidate(oauthToken);
    }

    @Override
    public Token retrieveAndRemoveToken(String oauthToken) {
        Token retrievedToken = retrieveToken(oauthToken);
        if (retrievedToken != null) {
            tokenCache.invalidate(oauthToken);
        }
        return retrievedToken;
    }
View Full Code Here

                                      @Nullable List<Header> requestHeaders, List<Header> responseHeaders)
            throws InvalidCredentialsException, IOException {

        String oAuthToken = credentials.getOauthToken();
        String oAuthSecret = credentials.getOauthTokenSecret();
        Token token;

        if (StringUtils.hasText(oAuthSecret)) {
            token = new Token(oAuthToken, oAuthSecret);
        } else {
            token = new Token(oAuthToken, "");
        }

        OAuthRequest request = new OAuthRequest(Verb.valueOf(method.toUpperCase()), url);

        if (data != null) {
View Full Code Here

        dao.removeToken(oauthToken);
    }

    @Override
    public Token retrieveAndRemoveToken(String oauthToken) {
        Token retrievedToken = retrieveToken(oauthToken);
        if (retrievedToken != null) {
            removeToken(oauthToken);
        }
        return retrievedToken;
    }
View Full Code Here

         */

        //The Access Token is used in all Data calls to the APIs - it basically says our application has been given access
        //to the approved information in LinkedIn
        Token accessToken = null;

        //Using the Scribe library we enter the information needed to begin the chain of Oauth2 calls.
        OAuthService service = new ServiceBuilder()
                                .provider(LinkedInApi.class)
                                .apiKey(API_KEY)
View Full Code Here

    // this is our first time creating this object so we need to populate the
    // accessToken

    Scanner in = new Scanner(System.in);
    Token requestToken = serviceProvider.getRequestToken();
    System.out.println(serviceProvider.getAuthorizationUrl(requestToken));
    System.out.println("And paste the verifier here");
    System.out.print(">>");
    Verifier verifier = new Verifier(in.nextLine());
View Full Code Here

        .apiKey(clientId)
        .apiSecret(clientSecret)
        .scope("https://mail.google.com/")
        .build();

    Token requestToken = oAuthService.getRequestToken();
    System.out.println("Retrieved Request token. Please paste the verifier from this URL:");
    System.out.println("https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token="
        + requestToken.getToken());

    System.out.print("\n> ");
    Scanner in = new Scanner(System.in);

    Verifier verifier = new Verifier(in.nextLine());
    Token accessToken = oAuthService.getAccessToken(requestToken, verifier);
    System.out.println("\nAccess token successfully retrieved: " + accessToken.getToken());

    return new OAuthorize(accessToken.getToken(), accessToken.getSecret());
  }
View Full Code Here

    public DropboxAccessToken() {
    }

    public Token toOauthToken() {
        if (error == null || error.length() == 0) {
            return new Token(token, secret);
        }

        throw new DropboxBaseException("Error while taking access token: " + error);
    }
View Full Code Here

TOP

Related Classes of org.scribe.model.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.