# Change Page in Workflow with Path from DB

**URL:** <https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760>\
**Category:** Ask us anything\
**Created:** [July 6, 2022, 8:49pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760 "2022-07-06T20:49:59Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [July 6, 2022, 8:49pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/1 "2022-07-06T20:49:59Z")

</div>

I am using Magic Link to login a user.

The DB response includes an authToken and a **Target URL** that the user should then be taken to.

The target URL will always change, and will include query string parameters. So, it may be something like /dashboard/property?property-id=35 or /dashboard/offer?offer-id=104&action=add

I tried using the Change Page Action, but I don’t think it will work because I cannot provide an array of query string variables. Only one variable with a set key.

I tried using the following JS, but it does not work… it produces a 404 error (this may have something to do with my DNS settings not being correct for naked URLS?)

```auto
window.location.pathname = 
context.workflow['7db9 ... 0dd2'].result['data']['target_url'];

```

How can I use a workflow action to send the user to a page in my site that includes query string variables?

Note: I’ve also tried to just use the page id from WeWeb, but then I cant get the query string variables in there.

I have control over the target\_url field, so I can set this up however needed to make this work.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [July 8, 2022, 12:00pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/2 "2022-07-08T12:00:16Z")

</div>

I was fiddling a bit with `wwLib`. It looks like you can do `wwLib.goTo('you rpage uuid', {your_query_name:'your query value'})`.

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [July 8, 2022, 12:02pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/3 "2022-07-08T12:02:11Z")

</div>

That’s brilliant! I’ll try it shortly. Thank you!

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [July 12, 2022, 8:28am UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/4 "2022-07-12T08:28:35Z")

</div>

We should definitly one day publish all wwLib function we want to expose :).

Be aware that wwLib functions may change later if we have not mark them as “public”.

Maybe we can start a subject with all of what you use (and so need), so we know what should be marked as public.

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [July 12, 2022, 12:38pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/5 "2022-07-12T12:38:35Z")

</div>

@aurelie Outside of some form validation JS, Here are the three things that I’m often using which are more custom:

1. **Changing page with multiple query items** like mentioned above. This could be simply solved by allowing a bindable array with key/value query string parameters in the Change Page action.

```auto
wwLib.goTo('you rpage uuid', {your_query_name:'your query value'}).

```

1. **Changing page to an outside URL in a workflow action**. There is the ability to go to an outside URL with a link, but not an action … I’ve been using this with Stripe Checkout:

```auto
location.href = https://wwww.checkout.stripe/foo-bar

```

1. **Login a user with an authToken** … When using MagicLinks, the front end receives back an authToken. We then need to log that user in on the front end. There is no way to do this right now with the auth plugins … I’ve been doing this with 2 actions:

a) Setting the WeWeb accessToken (plugins.Xano.accessToken)

```auto
variables[/* xanoAuth accessToken */ 'f5856798- ... c64e1-accessToken'] = context.workflow['896cc5e6-9f06- ... 4f2b9'].result['data']['auth_token']

```

b) Then fetching the user with a regular Fetch User action

(Note: I’m actually not sure if the Login with Auth Token workflow is working right now. I was receiving an error but might not be related to above)

---

<div class="post-metadata">

**Author:** ![Soenke](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/soenke/32/998_2.png) [@Soenke](https://community.weweb.io/u/Soenke)\
**Post date:** [July 27, 2022, 12:22pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/6 "2022-07-27T12:22:04Z")

</div>

@kevinwasie I am currently trying to call an outside URL in a workflow, similar to the Stripe Checkout you mentioned. Used your example of the location.href, but it looks like the new URL is not opening on a blank page but is loaded into a frame or something. This is blocked by the external Service I am calling. Do you know a possibility to open an external URL in a workflow on a blank page?

1. JS for external URL in workflow  

2. Resulting error page

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [July 27, 2022, 1:40pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/7 "2022-07-27T13:40:30Z")

</div>

@Soenke Does this happen when you publish your app also?

I think that is expected behavior for the editor, as WeWeb editor will not load external pages, but I think that should work in the published version.

Try publishing and let me know.

---

<div class="post-metadata">

**Author:** ![Soenke](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/soenke/32/998_2.png) [@Soenke](https://community.weweb.io/u/Soenke)\
**Post date:** [July 27, 2022, 2:10pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/8 "2022-07-27T14:10:22Z")

</div>

Still on the free plan 😬 so I cannot test it unfortunately

Currently I try to figure out if it makes sense to move my application from bubble to WeWeb, so I rebuild and test the most important parts of my app in WeWeb before entering the paid plan.

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [July 27, 2022, 2:14pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/9 "2022-07-27T14:14:54Z")

</div>

Got it. Okay… What you have there should work when you publish, and if something is wrong in the code, there will be a simple fix for it. Just cant load external pages in the editor.

---

<div class="post-metadata">

**Author:** ![Soenke](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/soenke/32/998_2.png) [@Soenke](https://community.weweb.io/u/Soenke)\
**Post date:** [July 27, 2022, 3:20pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/10 "2022-07-27T15:20:32Z")

</div>

Okay, sounds good.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [July 28, 2022, 12:59pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/11 "2022-07-28T12:59:07Z")

</div>

Testing actions that need redirect is not with the best dx in weweb.

If you need a redirect outside your weweb app try `window.top.location.href = "your url here"`.  
It will load the url in the topmost window so in the editor you will leave it and load the page.

If you need a return url (eg. stripe checkout) you need to dynamically build the url: if `context.browser['environment'] == "editor"` use `https://editor.weweb.io/your app id/your page id` otherwise create it with your published domain.

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [July 28, 2022, 3:09pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/12 "2022-07-28T15:09:39Z")

</div>

Because the editor load your app inside an iframe, be carefull with “window” inside editor :).  
Normally you have a change page action which can help me and handle all these corner cases.

---

<div class="post-metadata">

**Author:** ![dorilama](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorilama/32/10403_2.png) [@dorilama](https://community.weweb.io/u/dorilama)\
**Post date:** [July 28, 2022, 3:31pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/13 "2022-07-28T15:31:09Z")

</div>

Change page action works only for pages of the weweb app right?

If I need to redirect to an external site and test the flow of actions (eg. stripe checkout, I want to test a full purchase flow including redirect to checkout and back to the editor) I need to change the location of the top window with something like `window.top.location.href = "your url here"`.

A variable in `context.browser` with both the base editor url and the live app url will be helpful to set the redirects back to the app. Right now I am setting them by hand.

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [July 29, 2022, 12:32pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/14 "2022-07-29T12:32:45Z")

</div>

Hmm yes indeed Change Page is for now only for internal webpage.  
I am sending to the product team your suggestions: Change Page action should be able to redirect to external + expose the base url on variable.

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [July 29, 2022, 3:07pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/15 "2022-07-29T15:07:15Z")

</div>

Yes! @aurelie And possibly the ability to bind array keys and values to the querystring variables. I think this will be a common request internally and externally.

---

<div class="post-metadata">

**Author:** ![RCS](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RCS](https://community.weweb.io/u/RCS)\
**Post date:** [October 31, 2022, 9:27pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/16 "2022-10-31T21:27:21Z")

</div>

This is exactly what I am currently looking for in this post I recently posted. I checked the product roadmap and don’t see anything about this feature. Do you know if this is being worked on?

> [@Recreating Auth0 Login and Logout with Xano API endpoints](https://community.weweb.io/t/using-rest-apis-in-a-workflow-to-authenticate-users-in-xano-via-auth0-api-endpoints/1374):
>
> Hi, I am currently trying to authenticate users via APIs to my xano backend endpoints. I am using the Xano Auth0 plugin in the backend, because I want to have my user table in Xano not Auth0, while using Auth0 login. The Auth0 Weweb plugin does not call xano apis, therefore I am trying to set up the same setup but by calling Xano endpoints that were created by their Auth0 plugin. This is what my workflow for login currently looks like. I need to open up an external page, parse the resulting UR…

---

<div class="post-metadata">

**Author:** ![Mael](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mael/32/13246_2.png) [@Mael](https://community.weweb.io/u/Mael)\
**Post date:** [November 14, 2022, 11:46am UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/17 "2022-11-14T11:46:52Z")

</div>

Hello, with the change page you can bind an external page

 ![Screenshot 2022-11-14 at 12.46.38](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/836e1a956f4b3fea8f04a349ea347a6719407698.png)

---

<div class="post-metadata">

**Author:** ![foliodc](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/foliodc/32/761_2.png) [@foliodc](https://community.weweb.io/u/foliodc)\
**Post date:** [November 15, 2022, 2:24am UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/18 "2022-11-15T02:24:02Z")

</div>

I get an error when I bind to an external page:

 ![Snip20221114_1](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b98c2fa8f4d05f9b9875e2b28f7dc7098a235eb5.png)

“Error: Page not found. at Aa ([https://editor-cdn.weweb.io/public/js/index.931913bb.js:2583:123462](https://editor-cdn.weweb.io/public/js/index.931913bb.js:2583:123462)) at Proxy.runTest ([https://editor-cdn.weweb.io/public/js/index.931913bb.js:2583:339903](https://editor-cdn.weweb.io/public/js/index.931913bb.js:2583:339903)) at [https://editor-cdn.weweb.io/public/js/index.931913bb.js:2583:324841](https://editor-cdn.weweb.io/public/js/index.931913bb.js:2583:324841) at [https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:88766](https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:88766) at Zi ([https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:67544](https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:67544)) at eo ([https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:67635](https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:67635)) at HTMLButtonElement.n ([https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:76188](https://editor-cdn.weweb.io/public/js/chunk-vendors.30212033.js:165:76188)) at HTMLButtonElement.sentryWrapped ([https://browser.sentry-cdn.com/5.12.1/bundle.min.js:2:44863](https://browser.sentry-cdn.com/5.12.1/bundle.min.js:2:44863))”

---

<div class="post-metadata">

**Author:** ![RCS](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RCS](https://community.weweb.io/u/RCS)\
**Post date:** [November 21, 2022, 12:07am UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/19 "2022-11-21T00:07:25Z")

</div>

Thanks, I figured out that the social logins for xano should resolve my issue. So I may just wait for that update.

---

<div class="post-metadata">

**Author:** ![RCS](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@RCS](https://community.weweb.io/u/RCS)\
**Post date:** [November 26, 2022, 7:39pm UTC](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760/20 "2022-11-26T19:39:57Z")

</div>

@Mael I’m getting the same error as this.

[Next page](https://community.weweb.io/t/change-page-in-workflow-with-path-from-db/760.md?page=2)
