I would like to have a dynamic redirect URL for my integration with Facebook OAuth2. For example, if my redirect URL is in my Facebook application:
http://www.mysite.com/oauth_callback?foo=bar
I would like the redirect URL for a specific request to be something like this, so on the server I have some context on how to handle the authentication code:
http://www.mysite.com/oauth_callback?foo=bar&user=6234
My redirect is called after sending the authorization dialog, and I return the auth code, but when I try to get the access token, I get an OAuthException from Facebook. My query looks like this (adding lines for clarity):
https://graph.facebook.com/oauth/access_token
? client_id = MY_CLIENT_ID
& redirect_uri = http% 3A% 2F% 2Fwww.mysite.com% 2Foauth_callback% 3Ffoo% 3Dbar% 26user% 3D6234
& client_secret = MY_SECRET
& code = RECEIVED_CODE
All my parameters are encoded at the URL and the code looks valid, so I assume the problem parameter is my redirect_uri. I tried setting redirect_uri to all of the following, to no avail:
- Actual request URL to my site
- URL request to my site, minus the
code parameter - URL specified in my Facebook app setup
Are custom redirect URI options supported? If so, am I identifying them correctly? If not, will I be forced to set a cookie, or is there some better template for serving context to my website?
Jacob Jun 24 2018-11-11T00: 00Z
source share