Auth0 Home Blog Docs

Token not returned if I add scope to buildAuthorizeUrl

java
spring-security
buildauthorizeurl

#1

Hi,

I’ve based my app from the spring security mvc example.
When I add .withScope to the buildAuthorizeUrl it returns a null token, If I remove withScope it works fine. Snipped below. Am I missing something.

String authorizeUrl = controller.buildAuthorizeUrl(req, redirectUri)
.withAudience(String.format(“https://%s/userinfo”, appConfig.getDomain()))
.withScope(“profile email”)
.build();

Thank you.


#2

If I add it as a parameter instead it works. Well that was confusing.

.withParameter(“scope”, “openid profile email”)