App brought to foreground via URL no longer passing parameters - Our auth broken

We have been accessing Sign in with Google and Sign in with Apple thanks to the ‘App brought to foreground via URL’ event which passed us the parameters.

We were trying to address some issues with the login process and see that now we don’t appear to have any way to access the parameters anymore.


This breaks our auth process. Is there another way that we should be accessing the parameters?

App #98690
Page: Login

Hi,

Thank you for your report! There was a bug in our previous release.

We have just released a Hotfix #139A update that should fix this issue for you! Just refresh the browser to ensure that the fixes take effect. Hopefully it now works for you? Please let us know if you still encounter related issues!

Here’s the related changelog: https://docs.appgyver.com/changelog

Thanks, your report helped us to identify and fix the issue easily!

1 Like

Oh yay! Trying it now. I’ll report back.

It’s not working in my first round of testing, but that could be an issue on our part. My developer is at his day job right now and auth is his thing, but I’ll report back once he has had a chance to verify that our portion is all intact. Thank you @Kimmo!

The event outputs are showing up now! Thank you so much @Kimmo!

We had a new strange bug arise in the process; maybe you can give me an idea of whether this could be related.

The Sign in with Google process works great on Android. However, when I try it on the iPhone, it says “Safari cannot open the page because the address is invalid.”

I diff checked the url from Android and the url from iPhone, and they’re identical. I tried manually pasting the url into Safari on the iPhone and got the same result.

Hi! Not super sure, but after reading this I think you might need to try this on standalone with an URL scheme defined in the build settings for it to work correctly, or direct it to appgyver:// (I think?) while using the Preview app.

1 Like

Figured it out. Was totally an error on our part. Thanks!

1 Like

Hello @Erin_Wagner , @Mevi and @Kimmo ;
I need help with an OAuth2 setup and don’t no where to start in AppGyver. Am working with Google Firebase and needed to use OAuth2 in order to perform BatchWrites to the documents in a database.
can you please guide me where to start ?

Particularly: using OAuth2, how to get the authorization code and then using it to get the access Token. Also, how to open a second browser window for the user (me) to authenticate and authorize the request.
What’s the AppGyver URI to use in the HTTP Post request for the redirect call back from the Firebase authorization server and the “App brought to foreground via URL” event.

Thanks

Hi @lyn_Wayne! Doing our own auth required development work, so I hired a developer to do that. He did a great job; I could give you his contact info if you want. That being said, I think @William_Glass is on Firebase and was looking into auth stuff. Maybe he knows helpful stuff :slight_smile:

Hello @Erin_Wagner,
Thanks for the response and the suggestion. Would be nice if the developer wouldn’t mind sharing that piece of information with us on the platform for the benefit of all.

@William_Glass, I understand this is something you can help with, please assist.

Thanks

@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.

1 Like

Hello @Erin_Wagner,
Thanks for sharing.

Ciao Erin,
sorry but I’m stack in the step where you mention as redirect_url an url with appgyverrn:// in front
I’ve tried to use it and this is my link
https://accounts.google.com/o/oauth2/v2/auth?client_id=<MY_CLIENT_ID>&redirect_uri=appgyverrn
%3A%2F%2Fpage.Page3&state=status&response_type=token&scope=
https://www.googleapis.com/auth/userinfo.profile

but google is not accepting the redirect url
Do you have any tips for me to fix this issue?
Thanks as always for the support