-
-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
native platform fixes #951
base: master
Are you sure you want to change the base?
Conversation
}); | ||
|
||
const generateSessionToken = useCallback(() => { | ||
return uuidv4({ rng: randomGenerator }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we had an issue concerning usage of crypto.getRandomValues on iOS Native devices, we can use a random generator for session token generation which I think is good enough for the given scenario. This change works well on iOS devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of any reason these need to be cryptographically secure, can you? If not, this seems fine to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of any reason these need to be cryptographically secure, can you? If not, this seems fine to me
Yeah. I don't see any valid reason either to make it so secure.
@@ -628,6 +643,10 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => { | |||
setRequestHeaders(request, getRequestHeaders(props.requestUrl)); | |||
|
|||
if (props.isNewPlacesAPI) { | |||
request.setRequestHeader( | |||
'content-type', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Android native devices, the API request fails with the response message stating that it needs content-type
header. Adding the header resolves the issue with Android native devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help me understand why specifically this happens on android and if this is the only fix? As you stated in your App PR, adding this header causes CORS errors - I noticed this on dev too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks yeah please do, it is very strange. AFAIK that response is not coming from the server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks yeah please do, it is very strange. AFAIK that response is not coming from the server
@rafecolton That's correct. The response comes from android native implementation as referenced in the screenshot below. Since we have stringified the request body of our POST request, android native implementation expects content-type
to be sent. The only way to programmatically avoid this response is to avoid JSON.stringify but it does not seem to be a viable option for us.
So, It looks like we have to address the issue in desktop
platform along with the content-type
and we are discussing this here
Follow-up PR to this to resolve native platform issues:
content-type
to avoid API request failure on android native devices.