Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Perform OAuth flow in same window #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2014

Conversation

iangreenleaf
Copy link
Contributor

This part is actually quite simple. I had to rearrange some of my application to cope with the different workflow.

I created an endpoint in my app, /oauth/callback, and an OAuthCallbackController to handle it. Then I created a simple HTML file for my redirect URI, similar to oauth2callback.html but instead of loading Angular, it simply manipulates the URL to make it compatible with "hashbang" routing and pass it along to the Angular endpoint:

location.replace('/#/oauth/callback?' + location.hash.slice(1));

Then I'm able to access the OAuth params from my controller, set the token and all that good stuff:

  .controller('OAuthCallbackController',
    function($scope, $rootScope, $location, $injector, VgerCredentials, Token, $timeout, flash, User, UserTrackingId) {
      var params = $location.search();
      Token.verifyAsync(params.access_token).
        then(function(data) { ... }
    });

@enginoid
Copy link
Contributor

Looks good. Thanks again Ian – I appreciate it!

enginoid added a commit that referenced this pull request Sep 21, 2014
Perform OAuth flow in same window
@enginoid enginoid merged commit 0ee77c0 into angular-oauth:master Sep 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants