Facebook Oauth with NodeJS

Why should I be using an anchor? I don’t like the styling for bootstrap links, onclick js event seems fine to me, does the same task.

app/api/oauth/server_actionName.json

This is all I have ^ is that correct? what should the output file extension be called?

Because it needs to be loaded this way! Please just follow the tutorial exactly as it is explained. If you don’t like the anchor styling - modify it using css…

I already explained in previous post what the link should be:

href="api/oauth/server_actionName"

So it has no extension name? like in your PHP demo it has .php

If so I don’t have that it’s just a json file as I already explained in my previous post.

It must be entered exactly as i provided it in my example. No php, no other extension in the href link!

What you don’t have exactly? You already said you have the server action created, now you are saying you don;t have it … sorry but your posts are really confusing.

It’s really simple - just do exactly as i explained in my post above, if there are extensions needed to be added i will add them to my example. If extensions are not required i will not add them.
My example is exactly how it should be entered in the href of an anchor, please take a look at it.

Does this help you? I find the guide confusing sorry, since you say its a .php file that I need to point to. It’s not really simple for me, also this guide doesnt cover a custom flow for things like headers and response parameters.

I have a second api folder, should that be deleted?
image

The tutorial shows this for a PHP project. For a nodejs project the files don’t have .php extensions. Also the routes are automatically created so you don’t need extension added.

Copying this once again:

In your case:

<a class="btn btn-primary" href="/api/oauth/your_server_action">My Button</a>

replace your_server_action with the server action name. No extensions, just the name as listed in Server Connect panel.

No, don’t delete anything generated by Wappler. You should not be dealing with files like that, especially if you don’t know what exactly you are doing.

When click ‘open in browser’ from here:
image
It takes me to 404


I have deployed the application and refreshed the cache,
This link does the same 404:
image

I renamed the output file, removing the json extension:

Thanks for being patient with me…

So are the files actually there on your firebase hosting?
Are other pages in this project loading? There must be something wrong with your target/project setup.

I presume they are, there’s no way for me to view the actual files that are hosted

Don’t do that! This will break your server action. Don’t mess with the files in any way. It must be exacly as Wappler created it… the file won’t work without an extension!

Just don’t change anything manually. The only thing you had to do on your page i explained like 4 times in this topic …

It didnt work with the .json extension either

Should I just start a new project? something seems wrong here, I used a template then changed the project settings to .nodejs. When I created a node.js application before it had a index.ejs file

Please:

Don’t remove extenions from any file.
Don’t manually edit any file generated by Wappler.
Don’t delete, rename or move any folder created by Wappler.

Put the extension back as it was and simply create the anchor button i asked you to create on your page using the href i explained you to use for it.

Better create a new project and start again. You probably broke the whole project editing files like that.

“Put the extension back as it was and simply create the anchor button i asked you to create on your page using the href i explained you to use for it.”

I did all this but it didnt work :frowning:

“Better create a new project and start again. You probably broke the whole project editing files like that.”

I didnt manually edit the project until today when you said " replace your_server_action with the server action name. No extensions, just the name as listed in Server Connect panel."

This is why I renamed the file^

I was referring to the HREF attribute, not the Server Action itself!

You really need to read my posts more carefully before renaming or editing some random files.

Ok sorry thanks again for the patience, i’m going to try create a whole new project now.

Maybe you should start with simpler things, like page layout, publish. Then test server actions with simpler tasks so you get the idea of how the things work in Wappler.

Jumping directly in complicated tasks like oauth APIs without understanding how the basics work would make everything harder for you.

In the FB walkthrough; the screenshot looks different then today’s Server Connect screen;

image

There was a recent set of changes that changed the interface on the server side a bit.

In old demos there were only Server Connect files. Those have been renamed API. Also, APIs previously needed their own database connection actions, mailers, oauth providers, etc. however those are not available to the entire project under Globals—add once, is everywhere. You’ll must have to translate until the screenshots get updated.

2 Likes