Search code examples
oauthoauth-2.0linkedin-api

Linkedin OAuth 2.0 redirect URLs cannot contain fragment identifiers (#)


I have a Single Page Application where the url structure is typically http://mysite/#myview

I am trying to add this url to the list of authorized redirect URLs in the LinkdIn app settings but I am getting this error message:

enter image description here

Does this mean that there is no way I can redirect back to any url that contains # from LinkedIn API?

I have been able to do this making similar calls to the Twitter API, however they do not require you to register the URLs with them first in the way that LinkedIn does


Solution

  • Correct - LinkedIn will not allow # symbols in OAuth 2.0 callback URLs, however you can achieve a similar effect by using URL parameters that you internally map back on your side:

    https://www.example.com/auth/linkedin?ref=myview
    

    Then your server-side handler could process that ref=myview argument and redirect you to www.example.com/#myview