1

So I am using Stamplay facebook login. But it looks like I can not change the redirect URI. So after successfully login on facebook end, it redirect to this URI:

https://actorreels.stamplayapp.com/?jwt=[token]#/_=_

This will trigger my main route instead of the admin route - where I want user to land after login. Here is my stateProvider setting:

$stateProvider
.state('people', {
    url: '/:nameUrl',
    templateUrl: 'app/frontend/page.tmpl.html',
    params: { 
        nameUrl: {squash: true},
    },
    controller: "PageController",
    controllerAs: 'vm'
})
.state('admin', {
    url:'/admin/:userId',
    templateUrl:'app/frontend/admin/admin.html',
    controller:'AdminController',
    controllerAs: 'admin'
})

As you see, the return URI will trigger people route with nameUrl = "=". I want user to go to admin route instead with jwt as JSON token. How can I do that?

I understand there is $urlRouterProvider.when() I can use to make "/?jwt=" into my admin route. But I do not know how to do that (either in Regex or function...). Could someone help me to figure this out? Greatly appreciated!

Phil
  • 157,677
  • 23
  • 242
  • 245
Hugh Hou
  • 2,344
  • 5
  • 31
  • 55

1 Answers1

1

You can change the redirect URI for Stamplay inside the editor.

First go to the editor inside the USERS > AUTHENTICATION. Here you will see icons for all the social logins.
On the far right, you can select the cog icon to manage setting for your login flow. Here you can changed the redirect URI for login, and logout.

Note that for your angular application, include the route beginning with the #. For example. https://mystamplayapp.stamplayapp.com/ is the base url, so your need to enter #/route inside the editor to go to the "route" route.

  • As I understand, the #/route is a new feature just release on Stamplay. Since it won't work I tried it last week. But now it allowed to do #/route format. But it still won't solve the problem of getting the jwt token. Since the return URL is this format: https://[appid].stamplayapp.com/?jwt=[token]&[object%20Object]#/route/ Since the jwt token is before #, I can not grab it via ui-router. Is that possible to use ui-router to reformat the return URL into this format: https://[appid].stamplayapp.com/#/route/?jwt=[token] ? Also, what is that &[object%20Object] behind the token? – Hugh Hou Nov 30 '15 at 20:51
  • You cannot use ui-router mange this parameter, but if you use window.location.search, this will return an object of all parameter key value pairs. You can then use that object to insert properties to a angular route as preferred. You then can set the window.location.search to an empty object. This will however not remove the "?" from the url. To do this you will need to use the Browser History API to push a new state into the history so that it wont refresh the page, but will remove said question mark from the url. Again look into window.location.search and the browser history API. – Isaiah Grey Dec 08 '15 at 22:13