Announcement Announcement Module
No announcement yet.
redirect_uri isn't an absolute URI. Check RFC 3986. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • redirect_uri isn't an absolute URI. Check RFC 3986.


    I have almost finished the development but I run once again in an exception. The login with twitter works great. Now I will login with facebook - This works too in a test application (without Spring security) but doesn't work with my application I will publish.

    I get the following error at the browser (at this url:

       "error": {
          "message": "redirect_uri isn't an absolute URI. Check RFC 3986.",
          "type": "OAuthException",
          "code": 191
    Here are the ajustments I did at facebook:

    I did some research and the exception appears in the ProviderSignInController:

    @RequestMapping(value="/{providerId}", method=RequestMethod.POST)
        public RedirectView signIn(@PathVariable String providerId, NativeWebRequest request) {
            System.out.println("########################## signIn: " + providerId);
            ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(providerId);
            try {
                String oauthUrl = webSupport.buildOAuthUrl(connectionFactory, request);
                System.out.println("-------------------------- oauthUrl: " + oauthUrl);
                return new RedirectView(oauthUrl);
            catch (Exception e) {
                return redirect(URIBuilder.fromUri(signInUrl).queryParam("error", "provider").build().toString());
    The output of System.out.println is:
    -------------------------- oauthUrl:

    Actually I don't know what I'am doing wrong, I don't have a relative URL - All my URLs ate absolute.

    Does anyone know what I'am doing wrong? Maybe https is the problem or maybe the problem is that I don't have a content path (my redirect URL is https://localhost:8443/index.htm)

    I would be very appreciate if someone could help me - I have still lost 2 days with this issue.+
    Thanks a lot!!

  • #2

    Do you have an "applicationUrl" property set on your ProviderSignInController? I can reproduce the error you get if I set an applicationUrl on ProviderSignInController which doesn't start with a protocol - if I set it to "localhost:8080" instead of "http://localhost:8080" I get the same error as you.




    • #3
      What is clear to me is that the redirect_uri in the URL you gave is double-escaped. That is the percent-signs from the first escaping are also escaped with %25. What's not clear to me is why. I'd also be curious to see what your ProviderSignInController configuration looks like and wonder if you were to change it to begin with "https://" if it would solve your problem. There may still be a problem in ProviderSignInController, but if making a change like that fixes it for you then all the better.


      • #4
        I have solved this issue, it was once again my fault.
        In the classpath I had spring jar with version 3.0.6 and 2 spring jars with version 3.0.4 -> and this was the reason why the redirect-uri was double-encoded.
        Thanks for the help - now it works great!!
        All the best,


        • #5
          I'm seeing this issue as well. I'm running 3.0.4 across the board, so no "mix & match" issues.

          What I found is this: RedirectView calls UriUtils.encodeUriComponents on the URI *after* OAuth2Template has already URL-encoded it.

          Spring 3.0.4 is not compatible with spring-social. The minimum version which is compatible is v 3.0.5.

          Hopefully this will be of use to people.
          Last edited by curtistee; Mar 8th, 2013, 11:22 AM.