Search code examples
c#facebookfacebook-oauthfacebook-access-token

Why is the Facebook api returning #access_token vs ?access_token?


I'm making a call to facebook's api to get an oauth token. The process seems to work but the call back url is returned like this

http://localhost:52574/FacebookApi/AuthorizeCallback#access_token=CODE&expires_in=6953

I would expect the #access_token parameter to be returned as a standard query string parameter not a hash. Can anyone see what I'm doing wrong? Here is the code I'm using to generate the call back uri.

 public static Uri GetAuthorizationUri(string appId, string appSecret, string callBackUrl)
    {
        return new Uri("https://www.facebook.com/dialog/oauth?" +
           "client_id=" + appId +
           "&redirect_uri=" + callBackUrl +
           "&scope=publish_actions,publish_stream,create_event" +
           "&response_type=token" );
    }

Solution

  • Changing &response_type=code correctly returns a code that can then be exchanged for a token.