"Missing scope value" using java client library with login.inrupt.com

For testing purposes I dynamically registered my client via POST **inruptLoginRegistrationUrl and (using the clientId from the response) I’m using the Java client library like this:

import java.net.URI

val openIdProvider = OpenIdProvider(URI.create("https://login.inrupt.com"), DPoP.of())

val authRequest = AuthorizationRequest.newBuilder()
  .responseType("code")
  .scope("openid").scope("webid").scope("offline_access")
  .build("<client-id-from-reponse>", URI.create("http://localhost:8080/callback"))

val request = Request.newBuilder()
  .uri(openIdProvider.authorize(authRequest).toCompletableFuture().get())
  .GET()
  .build()

return "redirect:${request.uri()}"

The resulting URI (request.uri()) looks like this:

Which looks okay to me but upon using the URL the browser redirects to my callback URL with:

“Missing scope value” … What am I doing wrong here?

**(had to change this due to 2 link limitation for new users)

Hey there.

I could be completely wrong, however I am pretty sure you have to include a “scope” URI parameter which is not visible in your request URI. Example
https://login.inrupt.com/authorization?client_id=client-id-from-response&redirect_uri=http://localhost:8080/callback&scope=openid%20webid%20offline_access&response_type=code

And let me know if that fixes your issue (or at least gives you a different error :blush:)

1 Like

Yes you are right thanks for the hint. I managed to get it working by including the scope “openid” but why doesn’t the java library do it by itself? If I’m not mistaken the method openIdProvider.authorize(authRequest) should generate the correct authorization URI including the scope …

I do not know what library you are using so I cannot provide feedback. I Would possibly raise an issue on their github/gitlab/other source control resource.

Ah sorry my bad, should’ve mentioned this in the post, I’m using the official java library from inrupt GitHub - inrupt/solid-client-java: Java Client Libraries for Solid.

Hey thanks!

I was looking through their source files and found the problem here.

It looks like when you are calling this builder method

.uri(openIdProvider.authorize(authRequest).toCompletableFuture().get()),

the underlying .authorize method constructs a new builder which takes in an AuthorizationRequest object, however this internal call is not adding the “scope” parameter from the AuthorizationRequest provided. I would raise an issue on their github with it, to see if that is intended behavior or a bug.

I submitted an Issue on their Github repository

1 Like

Make sure you include the scopes value in the expected URI, hopefully Inrupt will get back to you soon!

1 Like