Dear All,
I have been stuggeling with a very basic issue, and I have not idea why this is not working.
Context:
I am testing the builtin firebase authentication in appgyver. The idea is to use custom claims in firebase to build an application that reacts differently based on the user’s roles. One use case for example is to show different content in the app based on the products that the user subscribed too.
Setup:
- My firebase project is created and the user already have a custom claim called “incidents” which is set to true. Using nodejs I can set and view the claims for the user.
- Appgyver app is created and the basic firebase authentication is enabled
Working flow logic - Web App
In the web app the following flow logic correctly gets the custom claim from the authentited user object and sets the app variable accordingly:
In the flow above the javascript function takes as input the firebase user object and get’s the custom claims:
try{
console.debug("Getting the auth data from the token");
var output = { };
var token = await inputs.firebaseUser.getIdTokenResult(true);
if(token && token !== undefined){
output.incidents = token.claims.incidents;
}else{
console.error("Could not get the auth data from the token: " + e);
return [1, { error: true }];
}
return { result: output }
}catch(e){
console.error(e);
return [1, { error: true }]
}
As a result of this function, the app variable is set. The binding to this variabe is visible below, where the user has the subscription for the incidents application ( shown with the toggle button set to true )
Not working - IOS Preview App
When I run this exact app via the Appgyver Preview app on IOS, the claims are not read and the app variable is not set.
My question
Is there something else I need to do to make this flow logic with javascript work also on IOS / mobile devices?
Thank you in advance for your time and support