Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to create a simple application using AngularJS and Google's OAuth2 for authentication.

Due to popup-blocking issues, and mobile friendliness, I decided I wouldn't use the Google APIs Client Library for JavaScript.

This left me with the option of doing a full redirect to the OAuth2 endpoint at google, and redirect users back to my app with the access_token.

I thought this would work just fine. The redirect URI would be 'http://myapp.com/#/register' with an appended 'access_token' query parameter. I would then consume the access_token and direct the user to somewhere else in my app.

This didn't work, as the Google API credentials (http://developers.google.com/console) don't like having a '#' in the Redirect URI's.

I then tried turning off the '#' requirement in URI's by using

$locationProvider.html5Mode(true);

This didn't work either, because explicitly browsing (in Chrome) to 'http://myapp.com/register' is not recognised by my Angular routes.

Any thoughts on how I should acheive this?

share|improve this question
    
Are you using url rewriting on your web server to rewrite myapp.com/register to myapp.com ? –  alexp Jan 18 '14 at 18:56
    
No i'm not, just using bare-bones IIS (as bare as IIS can get anyway :P ) –  mortware Jan 20 '14 at 12:20
    
Seems like you should try that - so that browsing to myapp.com/register does work. Then your Angular app handles mapping the /register to the correct route. Has the additional upside of making your app deep-linkable. –  alexp Jan 20 '14 at 15:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.