Skip to content

Commit bdb25f3

Browse files
committed
fix OAuth20Service::extractAuthorization when redirectLocation contains '#' part
1 parent a8f1e32 commit bdb25f3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ public DefaultApi20 getApi() {
215215

216216
public OAuth2Authorization extractAuthorization(String redirectLocation) {
217217
final OAuth2Authorization authorization = new OAuth2Authorization();
218-
for (String param : redirectLocation.substring(redirectLocation.indexOf('?') + 1).split("&")) {
218+
int end = redirectLocation.indexOf('#');
219+
if (end == -1) {
220+
end = redirectLocation.length();
221+
}
222+
for (String param : redirectLocation.substring(redirectLocation.indexOf('?') + 1, end).split("&")) {
219223
final String[] keyValue = param.split("=");
220224
if (keyValue.length == 2) {
221225
switch (keyValue[0]) {

0 commit comments

Comments
 (0)