Oath class cast exception in AuthConfig
See original GitHub issueVersion 3.0.3 affected, version 2.9.0 is not affected.
In line 231
this.service = (OAuth10aService) getOauthService(isOAuth1, addEmptyTokenToBaseString);
but getOauthService returns OAuthService with incompatible to OAuth10aService implementation: OAuth20Service. This leads to:
java.lang.ClassCastException: com.github.scribejava.core.oauth.OAuth20Service cannot be cast to com.github.scribejava.core.oauth.OAuth10aService
at io.restassured.internal.http.AuthConfig$OAuthSigner.process(AuthConfig.java:231)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:133)
Sample execution:
given()
.accept("application/zip")
.when()
.auth().oauth2(token, QUERY_STRING)
.get(Urls.pathToTest)
.then().log().all()
One note: without QUERY_STRING parameter it is working fine (and does not require com.github.scribejava optional dependency).
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
Explanation of ClassCastException in Java - Stack Overflow
Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. So,...
Read more >A ClassCastException may occur if two different JAX-RPC ...
A java.lang.ClassCastException error may occur if two different JAX-RPC Web service clients are running in the same Java.
Read more >ClassCastException (Java Platform SE 7 ) - Oracle Help Center
Class ClassCastException Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not...
Read more >2021年08月_weixin_39703561的博客_CSDN博客
2021-01-12. Not reusing HTTP connections via a pool? 2021-01-12. Oath class cast exception in AuthConfig. 2021-01-12. RARBG still has errors. 2021-01-12 ...
Read more >How to resolve a ClassCastException error message in ...
Contains information about resolving a ClassCastException error and converting data types. Spectrum supports different data types like integer, string, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also experiencing this problem with a slightly different use - simply trying to set default OAuth2 authentication for all requests:
RestAssured.authentication = RestAssured.oauth2(authToken);
I receive the same exception as reported by @kmaterka above.
To work around this I just explicitly create the OAuth2 scheme:
Simply calling
oauth2(token)
should work based on what I see in the docs.@chucknelson Your problem has been addressed in master. Please try version
3.0.4-SNAPSHOT
after having added the following maven repo: