Linkedin Angular 7 authorization api and route

Asked

Viewed 36 times

-1

I’m having a problem developing a login screen using Angular 7 and the Linkedin API. Backend is written in C#, and the problem is:
Linkedin requires a callback URL, and as far as I was able to search this is non-negotiable, unlike Facebook or Google, it is not possible to just recover the user’s data without a redirect, on the other hand the Urls in Angular have the character # that is not accepted by Linkedin, and when trying to register this type of URL, we have the alert:

Redirect Urls cannot contain Fragment Identifiers (#)

In an attempt to get around the situation, I started using the PathLocationStrategy, that solved the problem but brought another, now if user refresh the page, an error 404is released. I researched some time but could not find a solution.
You know how I can use it PathLocationStrategy and have no error while updating the page or some other way to recover user data using the HashLocationStrategy?

1 answer

0


I managed to solve problem by following this answer in the SO, and to me that I am beginner in front development, thing I do very rarely, was something I really did not understand. In case of link break, I leave rewritten the solution below.
Second text cited by the author of the reply:

When you have html5Mode enabled, the character # will not be used in your Urls. The symbol # is useful because it does not require server-side configuration. No #the URL looks better, but this also requires "rewrites" on the server side

As I use IIS server, I made the following change to my web.config

<system.webServer>
  <rewrite>
    <rules> 
      <rule name="Main Rule" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAll">
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="/" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.