How can i login user/token via webURL dummy web service?


#1

im trying to find the right method. To login via a web link () I saw a new cool dummy login webservice

not sure if im doing it correctly or what i was envisioning.

but i wanted to simulate login via studio url

(but still have a front login page for manual login) switch?

URL example
http://localhost:3000/api/ds_user=ddddd&ds_token=jiemi2m3ij

On this

I wanted to lookup the sheet that has those values on login band gather other cars while in session

ds_user = sheet.UserProfile column userID
ds_token = sheet.UserProfile column token

and when they are in (i was trying to get column sheet.UserProfilie.name to show up on landing page) like some how while logged in keep the values while logged in.

like
Welcome sheetUserProfile.name

do i link login data to like ds.slot ?

ds_profileName from sheetUserProfilie column name

does it work like that

push it to the local web service to looks up a local sheet ?

(also if user doesnt get a login link they can still manual front page.) Switch Script ?


#2

So i got half of it done (but not sure if its the best method or just hackery sourcery) lol

on First load it comes to Switch and then i pushed this I was looking at trying out browser router but it didnt work and i think i have to either add a plugin or import it .

function getParams(location) {
  const searchParams = new URLSearchParams(window.location.search);
  return {
    userID: searchParams.get('login') || '',
    token: searchParams.get('token') || '',
  };
}

http://localhost:3000/?userID=ddddd&token=jiemi2m3ij

const params = getParams('');

var token=params.token

i was looking into browser router but it didnt look like i can import

i set this to control the ds_slot logic in Switch method
var dsupdate = this.updateDataSlot('ds_login', token);

i did a if/then on if ‘success’ apply the switch logic in the UI and it works . i just dont know if i have to reset slots back to “” on page entrance or kills backlogic.

but now im going to try and lookup value and match what is in sheet and maybe update a slot for individual user data (i just dont know if i keep the profile ID and vars in that sheet row across other portion in app)


#3

i do got a question.

how do i remove the url address bar once submitted in the url and it works based on userID + token

i was trying to find a script area on when jumping to a Screen or Login gate to do a lil movement

i tried to do that but it takes you to the address.
//window.location = 'http://localhost:4444


#4

@sud0ritz I’m trying to get a URL parameter, pass it into a Slot and then use it for a Firebase call. I’m not too sure how to use your javascript in my file to make it run at the right time. Currently I have a snippet like this:

// Write your snippets here.

#SNIPPET Get Query Param for UserID

function getParams(location) {
const searchParams = new URLSearchParams(window.location.search);
return {
userID: searchParams.get('user') || ''
};
}
var paramUserId = getParams('userID');
this.props.appActions.updateDataSlot('ds_paramUserId', 'paramsUserId');

#ENDSNIPPET

​ I’m not too sure how to debug to see if it’s running, if the Slot is being updated etc.


#5

I’ve tried putting this in the top of the templates section, after the imports.

function getParams(location) {
  const searchParams = new URLSearchParams(window.location.search);
  return {
    userID: searchParams.get('user') || ''
  };
  this.props.appActions.updateDataSlot('ds_paramUserId', 'userID');
}

But still nothing happens…