Examples of TokenErrorResponse


Examples of com.google.api.client.auth.oauth2.TokenErrorResponse

        public LowLevelHttpResponse execute() throws IOException {
          MockLowLevelHttpResponse response = new MockLowLevelHttpResponse();
          response.setContentType("UTF-8");
          GenericData responseData;
          if (error) {
            TokenErrorResponse json = new TokenErrorResponse();
            json.setError("invalid_client");
            responseData = json;
            response.setStatusCode(400);
          } else {
            TokenResponse json = new TokenResponse();
            json.setAccessToken(NEW_ACCESS_TOKEN);
            json.setRefreshToken(NEW_REFRESH_TOKEN);
            json.setExpiresInSeconds(EXPIRES_IN);
            responseData = json;
          }
          response.setContent(JSON_FACTORY.toString(responseData));
          return response;
        }
View Full Code Here

Examples of com.nimbusds.oauth2.sdk.TokenErrorResponse


  public void testParseError()
    throws Exception {

    TokenErrorResponse response = new TokenErrorResponse(OAuth2Error.INVALID_GRANT);

    HTTPResponse httpResponse = response.toHTTPResponse();

    TokenResponse tokenResponse = OIDCTokenResponseParser.parse(httpResponse);

    assertTrue(tokenResponse instanceof TokenErrorResponse);

    response = (TokenErrorResponse)tokenResponse;

    assertEquals(OAuth2Error.INVALID_GRANT, response.getErrorObject());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.