Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Verification #583

Open
Adam-Burke opened this issue Jan 23, 2017 · 3 comments
Open

Verification #583

Adam-Burke opened this issue Jan 23, 2017 · 3 comments

Comments

@Adam-Burke
Copy link

Sorry, I'm hoping someone can point me in the right direction.

I want to verify a users email and then redirect to my app.

Is it possible to verify with stormpath directly then redirect to my login page? The Workflows and emails page in the stormpath ui only has Link Base URL which I guess means I have to provide the route for verification myself?

How do I do this using the JSON API stateless version of the server. Do I need to use the nodejs sdk?
Is the client object and tenant object from that sdk available in express-stormpath. It seems the verifyEmail function is only available on the tenant object.

I think I'm missing something.

Cheers,

Adam

@mdeggies
Copy link
Member

Hey @Adam-Burke! If you're using express-stormpath, all you need to do is set the link base URL to http://localhost:3000/verify, and then enable that route in the Stormpath config section in your server file:

app.use(stormpath.init(app, {
  ....
  web: {
    verifyEmail: {
      enabled: true,
      nextUri: "/login"
    }
  }
});

For future reference, you can configure a whole mess of things in app.use(stormpath.init...). This is a good place to start: https://docs.stormpath.com/nodejs/express/latest/configuration.html. It also links to 'Web Configuration Defaults' which contains a full list of the things you can customize: https://github.com/stormpath/express-stormpath/blob/master/lib/config.yml.

LMK if this helps or if you have any follow-up q's!

@Adam-Burke
Copy link
Author

Adam-Burke commented Jan 23, 2017

Thanks @mdeggies.

I placed that config in but it is just returns a missing route on the server. Doesn't that only work if you are using express-stormpath as traditional web app or spa? I'm only using it for auth and to dispense json.

The localhost:3001 server is just my localhost dev url where my app is being served. I'm serving the html seperately from the express-stormpath server. They're on different ports but cors is enabled.

expand: {
  customData: true,
  groups: true,
  groupMemberships: true,
  providerData: true
},
web: {
 produces: ['application/json'],
 verifyEmail: {
    enabled: true,
    nextUri: 'http://localhost:3001/login'
 }
}

Thanks for helping!

@the-overengineer
Copy link

the-overengineer commented Feb 7, 2017

@Adam-Burke One thing to note is that the email verification workflow also requires the whole thing to be enabled in the Directory used by your application. You can do this in the dashboard in api.stormpath, under Directory/Workflows & Emails. Just ran into this myself and figured it might help.

It should otherwise work with both SPA and traditional apps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants