Skip to content
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

Gulp serve , with oauth callback #21

Open
pradeepmurugesan opened this issue Sep 28, 2016 · 1 comment
Open

Gulp serve , with oauth callback #21

pradeepmurugesan opened this issue Sep 28, 2016 · 1 comment

Comments

@pradeepmurugesan
Copy link

Hi, this is more of a query, not a bug.

I am having a UI built using angular js and we use gulp to package the same.

Our application is though a Java web app so we use https://github.com/eirslett/frontend-maven-plugin to build and copy the UI component into the webapp directory.

We use Oauth's Authorization code grant to authenticate the users and the callback url will be handled by the java's callback servlet.

Since the login is dependent on the Java callback servlet, development cycle is becoming hectic.

Is there a way to make the gulp serve also serve the callback redirect from the oauth server so that we can take the java app out of equation during our development phase ?

I mean asking like can I have gulp serve (webserver) to serve one more route (/callback) and then redirect to home page after successful authentication. Is that possible ?

@opyate
Copy link

opyate commented Jun 27, 2017

You've got a few ways of solving this:

  1. use a web proxy, e.g. nginx, and just match the callback route to another handler
  2. see if your frontend stack can handle it for you (e.g. you said you're using Angular, so use $locationProvider.html5Mode(true); and connect-history-api-fallback as a gulp-serve middleware) This is usually preferred, as your callback almost always has to set state on the client.

In the gulpfile:

var history = require('connect-history-api-fallback');

// ...

gulp.task('statics', g.serve({
  root: ['./.tmp', '...'],
  middlewares: [history({})],
  // ... and so forth

BTW, the Auth0 devs have some really good examples to go with their Oauth solutions: https://github.com/auth0-samples/auth0-angularjs-samples/

I guess the callback Angular controller can then talk to your servlet and do the necessary token hand-off.

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

No branches or pull requests

2 participants