2017년 4월 13일 목요일

OAuth Error while trying to read from fusion table


I am trying to access a smart table that contains information about customers and their car. Each customer is associated with a QR code that contains a 5 digit number. When I scan the QR, I want it to grab the row with their number and bring it back to the app so the user can read the customer data. Eventually this app will be used to determine if a customer has payed their monthly dues for a membership to a car wash. I built a register screen that allows the user to register customers by sending data to the same fusion table, adding a new row. This function works perfectly. I am using a service account, a p12 key file, and the table ID, and I am successfully able to add customers to the fusion table. However, when I try to read from it using a "GetRowsWithConditions" block, I get an 401 unauthorized error. This screen uses all the exact same information as the register screen, and I even tried just using the Query block to send the SELECT command, attempting to get the row information to pop up in a notification. ieven recreated the p12 key file, uploaded it and attached it to both the scan and register screen. I can register but not read the table. Attached I have the error and my Screen 1, home screen blocks. Ignore the warnings at the bottom, those are associated with detached blocks I removed to debug the issue. Any suggestions?


--
use the service account method

and do the Pizza Party tutorial to learn how to work with fusiontables and how to do the setup correctly

-- 
Like I said, I am using the service account method, my table and blocks are set up correctly since I am able to successfully write to my table, and I did the Pizza Party tutorial before I started working on my app but it does not contain any tutorials on sending queries to the fusion table . Still need help on this issue please.

-- 

 However, when I try to read from it using a "GetRowsWithConditions" block, I get an 401 unauthorized error. 

your screenshot does not show this block
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

-- 
I did away with that block and exchanged it for a query block instead. I can show you what I did previously with the GetRowsWithConditions block if you can help me to get that to work.


-- 
you forgot to quotify the BarcodeScanner.Result

-- 
Whoops, thanks. Regardless the issue remains. Do I need to quotify the table ID?

-- 
Do I need to quotify the table ID?
no
btw. you don't have to quotify the column names (only if you use spaces in column names)...
did you get it running using the SELECT statement?
if yes, why wasting time to do the same with the GetRowsWithConditions block?
you might want to provide an updated screenshot...

-- 
bt. from your error message you can see, that you forgot spaces before and after the tableid...



-- 
I tried both a query block with a SELECT command and the GetRowsWithConditions block separately and they both return the same error. I don't have a preference to either one, I just need one of these two options to work.


-- 
you might want to fix the missing spaces and provide an updated screenshot...

-- 
Of course. Here is what I'm working with right now



-- 
in the blocks screenshot it looks like you still forgot to quotify the BarcodeScanner.Result (but in the error message the query looks fine)... or is the scanner result already quotified?

to find it out, you can use Do it, see also tip 4 here

probably there is a space in the service account email address?
recreated the p12 key file, uploaded it and attached it to both the scan and register screen.

and you assigned the p12 file to the keyfile property in the second screen?
you might want to provide a screenshot of the Designer and its fusiontable control settings...

what happens, if you run the same query in the register screen?

-- 

댓글 없음:

댓글 쓰기