Bypassing token usage?

Hello!

I’ve been trying to create a simple javascript web application to add records to my SQLite database in Dreamfactory using the API calls. I’ve been trying to follow much of the example Address Book Javascript sample application, and understand almost all of it. In this way, I’ve used their same javascript function definition and call for my own application.

I believe I have narrowed the issue in my code and application to the use of the session token, as I’ve used the getToken() javascript function to inspect the token, and it returns “null”. I do not want users to have to login, and thus, I do not get a session token that would be required in those setRecord() function calls.

Is there any way either to remove the need for a token or to set a default token upon the web page being opened, so that users would not have to log in?

Thanks for any help anyone can provide.

UPDATE: I fixed my own issue by simply removing the token parameter in the function definition and function call, and removing the header “X-DreamFactory-Session-Token”: token from the function definition. I would delete this post, but I don’t know how to.

1 Like

@tjvh You can set up access using just the API key or use guest access. Check out the tutorials below:

https://wiki.dreamfactory.com/DreamFactory/Tutorials/Access_Using_API_Key

https://wiki.dreamfactory.com/DreamFactory/Tutorials/Setting_up_guest_access

2 Likes

Hey @tjvh thanks for updating your thread to include your fix! We won’t delete it, because it may be found useful to another community member.

Glad to hear it’s working for you now.
@AlexBowen

1 Like

Thank you for all your help!

1 Like