# |
Dec 29th 2018, 15:57 |
NickBusey |
All the rest of my API works, user api fails |
# |
Dec 29th 2018, 15:57 |
NickBusey |
I'm not? I have disabled them both |
# |
Dec 29th 2018, 15:57 |
admad |
Nor csrf component/middleware |
# |
Dec 29th 2018, 15:56 |
admad |
Don't use securitysecomponent for api |
# |
Dec 29th 2018, 15:56 |
challgren |
@admad https://cakesf.slack.com/archives/C053DPNGT/p1546097289329500 |
# |
Dec 29th 2018, 15:56 |
NickBusey |
I have disabled the Security component, but it seems to be used anyway for the CakeDC/users login function |
# |
Dec 29th 2018, 15:55 |
NickBusey |
Because when I submit the login form, I get errors about missing _Token's, and csrf protection |
# |
Dec 29th 2018, 15:55 |
admad |
NickBusey: "I should 100% be able to present a native login screen in whatever client type I am working with, submit a request, and get a token back" what's preventing you from doing that? |
# |
Dec 29th 2018, 15:53 |
admad |
That will trigger the jsonn view being used just like it does for .json extension |
# |
Dec 29th 2018, 15:52 |
admad |
@k4t add "Accept: application/json" header to request |
# |
Dec 29th 2018, 15:52 |
NickBusey |
I should 100% be able to present a native login screen in whatever client type I am working with, submit a request, and get a token back. Having to load a webview or whatever is a hacky workaround |
# |
Dec 29th 2018, 15:52 |
NickBusey |
I don't really agree that is the issue, that is the specific problem I'm running into now, but it shouldn't be. Expecting an API client and API server to be on the same port/domain is not a reasonable assumption |
# |
Dec 29th 2018, 15:51 |
challgren |
The different ports/domains are where you run into issues |
# |
Dec 29th 2018, 15:51 |
challgren |
Cause you could log the user in with cake and then dump them into your react app and continue on |
# |
Dec 29th 2018, 15:51 |
NickBusey |
Martin`: `remember` just provides some simplicity/magic around Cache::read / Cache::write, use those directly |
# |
Dec 29th 2018, 15:50 |
challgren |
Well with the different ports that is causing your auth issues |
# |
Dec 29th 2018, 15:50 |
Martin` |
but that is not possible with remember I quess? |
# |
Dec 29th 2018, 15:50 |
NickBusey |
Well react isn't really the issue here, native apps would need the same functionality |
# |
Dec 29th 2018, 15:49 |
NickBusey |
Martin`: Sure, just add a bit in the error handler of the api request, to load specifically from the cache what you saved on the last successful request |
# |
Dec 29th 2018, 15:49 |
Martin` |
I'm using Cache::remember for that |
# |
Dec 29th 2018, 15:49 |
challgren |
Id keep asking around Im not an expert with the crud plugin and react |
# |
Dec 29th 2018, 15:48 |
Martin` |
I'm using the cache for reading data from external api's so it is not needed every request, but it is possible to fall back to cache when api request fails? |
# |
Dec 29th 2018, 15:47 |
NickBusey |
Well, sounds like Cake won't be able to do what I need it to, or at least the User plugin. Ah well, the search is on for another back end I suppose. Thanks for the help! |
# |
Dec 29th 2018, 15:44 |
NickBusey |
https://gitlab.com/NickBusey/mashio |
# |
Dec 29th 2018, 15:44 |
challgren |
Serving it from the webapp folder allows you to use cookies |
# |
Dec 29th 2018, 15:44 |
NickBusey |
And that looks almost identical to my setup |
# |
Dec 29th 2018, 15:44 |
challgren |
nm thats some old code |
# |
Dec 29th 2018, 15:44 |
NickBusey |
I'm more than open to suggestions on simplicity, but it seems like the only thing to do would be to serve the SPA from cake's webapp folder, which I may do, but doesn't really buy much during development |
# |
Dec 29th 2018, 15:43 |
challgren |
You look at https://github.com/Rubyan/CakePHP-react |
# |
Dec 29th 2018, 15:42 |
NickBusey |
The SPA server is not able to store cake goodies in the DB, the cake server is not able to serve the SPA app properly |
# |
Dec 29th 2018, 15:42 |
NickBusey |
You are more than welcome to your opinion :) This is a fairly common setup |
# |
Dec 29th 2018, 15:41 |
challgren |
Running 2 servers to accomplish really the same thing |
# |
Dec 29th 2018, 15:41 |
challgren |
Seems a bit overkill |
# |
Dec 29th 2018, 15:40 |
NickBusey |
so no, not really |
# |
Dec 29th 2018, 15:40 |
NickBusey |
same site? not sure what you're asking exactly, they run on different ports if that's what you mean |
# |
Dec 29th 2018, 15:40 |
NickBusey |
I'm using that to talk to cake |
# |
Dec 29th 2018, 15:39 |
NickBusey |
https://preview.pro.ant.design/dashboard/analysis |
# |
Dec 29th 2018, 15:39 |
challgren |
Is your react spa on the same site? |
# |
Dec 29th 2018, 15:39 |
challgren |
it asks for an API key |
# |
Dec 29th 2018, 15:39 |
challgren |
I was saying more look at the login on android |
# |
Dec 29th 2018, 15:39 |
NickBusey |
I have no idea how android code works, no idea where to even start looking in that repo |