How to pass signInSuccessUrl dynamically to gitkit identity toolkit's widget - google-identity-toolkit

I am trying to pass the signInSuccessUrl parameter dynamically to the widget page as an URL parameter. Unfortunately without success.
According to the gitkit forum (https://groups.google.com/d/msg/google-identity-toolkit/grF6C4CByEk/Dz4l2P-mTOwJ) this should work.
Am I missing something? Thank you.
That's what I tried:
The signin.html page showing the widget is configured like this:
JS Config:
var config = {
apiKey: '...',
idps: ["googleplus"],
//signInSuccessUrl:NOT SPECIFIED CAUSE WE PASS IT VIA URL,
oobActionUrl: '//127.0.0.1:8888/gwt/servlet/gitkit/email',
siteName: 'SN',
};
window.google.identitytoolkit.start(...);
Open browser and show Javascript console of browser
Enter the widget page url in browser:
http://127.0.0.1:8888/signin.html?signInSuccessUrl=127.0.0.1%3A8888%2Fgwt%2Fservlet%2Fgitkit%2Fsignedin%0A&o=dynamic
Continue with sign in...
This will not redirect to signInSuccessUrl but rather produce the error:
Uncaught Error: Configuration signInSuccessUrl is required.Si # gitkit.js:217Ik # gitkit.js:248(anonymous function) # gitkit.js:257(anonymous function) # gitkit.js:152(anonymous function) # gitkit.js:213Fc # gitkit.js:38h.dispatchEvent # gitkit.js:36zi # gitkit.js:210U.onReadyStateChangeEntryPoint_ # gitkit.js:208U.onReadyStateChange_ # gitkit.js:208
NOTE: if I set the signInSuccessUrl param in widget config, like:
signInSuccessUrl:"//127.0.0.1:8888/gwt/servlet/gitkit/signedin?o=hardcoded",
It will work but NOT use the signInSuccessUrl provided in the URL but the hardcoded one, i.e. the 'o' param in this example will not be overriden.

The reason it did not work was related to using the open scheme in oobActionUrl
'//127.0.0.1:8888/gwt/servlet/gitkit/email'
When using 'http://127.0.0.1:8888/gwt/servlet/gitkit/email' it did work.

the signInSuccessUrl in the widget configuration is a required field. You always have to provide it. The signInSuccessUrl parameter in the widget url if provided will override the config value. This makes sense since the signInSuccessUrl query parameter is optional and may not always be provided in the url. Try providing it in the config and then pass it in the url. It should work the way you want it to.

Related

Firebase Deep Link with custom parameter at the end

I created a Firebase Deep Link for my Flutter app to open the app after the registration process was successful. The link looks like the following:
https://myLinkDomain.page.link/routeName/
During the registration process, a parameter must be appended to the end of the link, which I must read out in the app for successful completion.
The problem is that if I append the parameter to the end of the link, I can no longer access it. The link in this case looked like this:
https://myLinkDomain.page.link/routeName/?myCustomParam=myValue
If the parameter is given in the middle of the link, I can use it in the app. Like this:
https://myLinkDomain.page.link/routeName/?myCustomParam=myValue&apn=someStuff&isi=someStuff&ibi=someStuff&ifl=someStuff
However, the registration process requires that the parameter be added to the end of the link.
Is there a way to build the Firebase Deep Link so that the parameter can be added at the end and still be recognised in the app?
Thanks for any help!
No matter when this parameter goes - at start or at the end of the line.
I had the same problem with passing some custom parameters to my app.
Here is we should start with manual url construction:
firebase manual link construction
I have no easy way to pass parameters, so I just change the link parameter body to put here more parameters:
https://example.page.link/?link=https://example.com/?route%3Dprofile%26param1%3DA%26param2%3DB&apn=some&isi=some&ibi=some
prefix: https://redecor.page.link/
main body in link parameter (should be encoded). There is the place for all needed parameters you want to pass (route=profile&param1=A&param2=B) - all parameters should be encoded!
encoded should be like this: route%3Dprofile%26param1%3DA%26param2%3DB
other parameters (what are they means you could read here) for firebase proposes (no needs to encode):
apn=some&isi=some&ibi=some
Never mind. The solution is to change the order of the url parameters: myLinkDomain.page.link/routeName/…

next.js - dynamic route consisting of multiple slugs?

Is it possible to structure a route that contains dynamic parts in predefined format, such as /[name]-id[id], for example to have routes /bob-id303 or /mary-id205?
What I tried is create a file [name]-id[id].js. Inside getInitialProps I console.log the ctx and it contains
pathname: '/[name]-id[id]',
query: { 'name]-id[id': 'bob-id303' },
asPath: '/bob-id303',
On the other hand, calling the file [[name]]-id[id]].js gives
Failed to reload dynamic routes: Error: Optional route parameters are not yet supported ("[[name]-id[id]]").
I'd like to get the name and id directly, then pass them through initial props to the page. I'm aware I can parse asPath, but is there another way to do this?
You could use /[slug] and then do slug.split("-id"). However you may be better off doing the id alone followed by a fetch for metadata because the name could change and then that url would potentially 404.

Configuration of plugins

I try to use the following plugins in local mode:
s.Util.cookieRead https://marketing.adobe.com/resources/help/en_US/sc/implement/util_cookieread.html
s.Util.cookieWrite https://marketing.adobe.com/resources/help/en_US/sc/implement/util_cookiewrite.html
When I type in console i.e. s.Util.getQueryParam I take back the function which seems that the configuration in file it is allright.
s.Util.getQueryParam
AppMeasurement.a.Util.getQueryParam(c, b, d)
How ever when I go to add the example in plugin function
s.campaign = s.Util.getQueryParam("cid");
when I run my site I can't see anything of this plugin
Also when I use the
getNewRepeat https://marketing.adobe.com/resources/help/en_US/sc/implement/getNewRepeat.html
plugin it always shows me as New visitor.
Is there any special configuration I should make in order to make them to work properly?
// set a session cookie named foo to value 'bar'
s.Util.cookieWrite('foo','bar');
// look for cookie named 'foo' and return value if found, and assign it to prop1
s.prop1 = s.Util.cookieRead('foo');

Meteor Iron Router does not get Current Path from Route

In a Template Helper I get the current path from Iron.Router (iron:router) as follows:
Router.current().route.path(this);
This works fine, unless the route path does contain parameters (e.g. /client/:_id/edit). In that case the path() function returns null.
How do I get the current path within a Template Helper, when the route contains parameters?
There are posts around covering the issue but the solution mentioned there seem not to fit.
I'm using Meteor 1.1.5 with iron:router1.0.7
According to this iron-router/issues/289 there are problems when the path contains parameters. The suggestion to use Iron.Location.get().path This works well for me.

Play Framework - how do I redirect to a page generated by a plugin controller? [SecureSocial]

I have this in my routes.conf file:
# SecureSocial routes
# Login page
GET /login securesocial.controllers.LoginPage.login
And then I have this in a Scala Controller file
val index = SecuredAction { implicit request =>
Redirect(routes.UserOps.watchlist)
// how do I go straight to /login? >|
}
Doing this takes me to a login page that has a red error bar saying "you must be signed in to view this page". If I access `localhost:9000/login' I get the login page without the error bar.
Normally I do a Redirect(routes.SomeControllerObject.ActionMethodName) but in this case the controller I need to access is in a plugin...
I feel like I'm missing something rather large here...
Update:
To reverse-route to an action in a plugin controller you need to provide the correct, full path to the plugin's routes class.
Redirect(securesocial.controllers.routes.LoginPage.login)
Original Answer
For reverse-routing I don't think it matters where the Controller is since Play is building that when the project compiles. From the documentation:
For each controller used in the routes file, the router will generate a ‘reverse controller’ in the routes package, having the same action methods, with the same signature, but returning a play.api.mvc.Call instead of a play.api.mvc.Action.
So this should work just as if LoginPage was a controller directly in your app.
Redirect(routes.LoginPage.login);
In order to show the message, you must have an item in the Flash. When you hit /login directly, there is no flash, so you won't see that message.
If you want to see that message:
Redirect(securesocial.controllers.LoginPage.login).flashing( ... )

Resources