문제

using Grails 2.3.8 and

plugins {
  compile ':spring-security-core:2.0-RC2'
  compile ':spring-security-oauth:2.0.2'
  compile ':spring-security-oauth-facebook:0.1'
  compile ':spring-security-oauth-google:0.1'
}

and the default providers setup:

oauth{
 providers{

facebook{
  api = org.scribe.builder.api.FacebookApi
  key = '11111'
  secret = '222222'
  successUri = "http://localhost:8880/oauth/facebook/success"
  failureUri = "http://localhost:8880/oauth/facebook/error"
  callback = "http://localhost:8880/oauth/facebook/callback"
  scope = 'email'
}
}

As I understood, I have to use the absolute URL's for callbacks. That is a problem, as my app is mapped to several domains, like myapp.com, myapp.de, myapp.ru etc.

Is it possible out of the box to provide the callback URL's for each domain?

TIA

도움이 되었습니까?

해결책

so, I figured it out!

the solution contains a bit of ugliness, but works like charm:

in my Config I had to change the providers so, that the server name is reflected in provider name and callback-URLs:

oauth{
  providers{

    facebook{
      api = org.scribe.builder.api.FacebookApi
      key = '11111'
      secret = '22222222'
      scope = 'email'
    }

    'facebook_localhost'{
      api = org.scribe.builder.api.FacebookApi
      key = '111111'
      secret = '222222222'
      successUri = "http://localhost:8880/oauth/facebook_localhost/success"
      failureUri = "http://localhost:8880/oauth/facebook_localhost/error"
      callback = "http://localhost:8880/oauth/facebook_localhost/callback"
      scope = 'email'
    }

    'facebook_wwwmysitenet'{
      api = org.scribe.builder.api.FacebookApi
      key = '9999999'
      secret = '888888888888'
      successUri = "http://www.mesite.net/oauth/facebook_wwwmesitenet/success"
      failureUri = "http://www.mesite.net/oauth/facebook_wwwmesitenet/error"
      callback = "http://www.mesite.net/oauth/facebook_wwwmesitenet/callback"
      scope = 'email'
    }
  }
}

to make processing easier, I remove the dots from the server name.

The same I made for google.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top