JamesRandall / AngularJS-OAuth2

Package for allowing an AngularJS application to authenticate with an OAuth 2 / Open ID Connect identity provider using the implicit flow.
MIT License
46 stars 42 forks source link

Support WSO2 redirect format with HTML5 mode enabled #9

Closed m1kl closed 4 years ago

m1kl commented 9 years ago

Hi,

I am using WSO2 API Manager as my Identity Provider and after the authorization is done, WSO2 makes a redirect with the following format:

http://localhost:3000/public#access_token=...&state=...&expires_in=...

When you check if HTML5 mode is enabled, I added code to verify first if there is any hash in the url and handle it if it exists, in the other case I let the code that was already there.

m1kl commented 9 years ago

Hi,

In my angular projects, I've been using the ui-router for the routing mechanism.

I added the stateChangeHandler event to trigger the authorization process when the state has the requiresToken attribute (as you do for the routeChangeHandler).

I also used the angular $injector to get a reference of the ui router $state service. This $state service is used to be able to save the requested state and its parameters.