@lyn_Wayne, he actually did, but I can’t find the post anywhere. I guess the thread was deleted. Here you go:
Google Sign-in within AppGyver
There are a few key things required for Google Sign-in within an AppGyver app.
- Backend API
- Device Storage
- “Open URL” Function
- “App brought to foreground via URL” trigger
Here’s some guidance on how we did it.
Backend API
Within your backend API, there are two key endpoints you need: An OAuth callback and an “internal” authentication endpoint.
OAuth Endpoint
This should be implemented like any typical OAuth endpoint. However, the key part of this is that once the code is validated and token is generated, you need to respond with a redirect to your app containing the token generated. While debugging with the AppGyver app, the redirect URL will start with appgyverrn://
, and when in production it will be whatever you set within the build configuration. I suggest passing this through the OAuth flow via the state
parameter so it can be configured on the app side.
“Internal” Authentication
This is where you handle the generation of the URL to begin the OAuth flow. We did this by POST
ing to this endpoint with the token stored on the device, verifying that token, and if the token is valid, returning the data about the user needed for the app. If the token is invalid, we return the URL to begin the OAuth flow.
Device Storage
The third key component to all this is using the device storage components available in the Flow Function Market. Just search for “storage” there and you’ll find the Get/Set/Delete functions you need.
Upon a successful authentication flow, we store the token returned by the redirect URL mentioned above.
“Open URL” Function
In order to initiate the OAuth Flow with Google, you must open the authentication link in a separate browser. The “Open URL” Function in the Flow Function Market will allow that capability.
“App brought to foreground via URL” trigger
In order for the app to handle the final redirect from the OAuth endpoint to the app, you must have a trigger for “App brought to foreground via URL” in your flows somewhere. You can find this within the list of options under “Advanced -> Receive Event.”
Final Thoughts
The flows required for all this to work are non-trivial. Our login page flows are quite complex and there are details left out, but these are the key components required to make it happen.