35
Views
10
Comments
Phone number authentication using Firebase
Question

Can anyone tell me  how to implement  firebase phone number authentication service in outsystems, I already tried using JavaScript  when I try to run this am always getting this error   can someone please help me with this issue

UserImage.jpg
Shamshad Akther

You can use RequireScript Client action to include the scripts to the Application. 

1. Include the action from Manage dependencies ==> System ==> RequireScript action

2.  Then go to create Logic tab, under ClientActions create OnReadyApplication action 

3. Call/Drag two RequireScript action inside the OnReadyApplication action flow and define each URL to each action (firebase.app and firebase-auth).

Note: One RequireScript can only call one URL. So, you need to call the action 2 times.

UserImage.jpg
Annish J K

Hi I tried this, but am getting this error. First am calling this url "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js" and then "https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js"

2022-08-03 04-32-50
Ravi Punjwani

Hi @Annish J K 

With the solution Shamshad suggested, it won't work with the module javascript files. It could have worked if your javascript file didn't need to be loaded as a module script.

UserImage.jpg
Annish J K

then what should be the script type can you  please help me with this 

UserImage.jpg
Shamshad Akther

from the error it seems the version 9.x.x is a JS modules. export is valid for type module scripts and modules are imported using 

<script src="https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js"></script> . 

You can try different version like 8.x.x or use JS to import them (as your initial code snapshot). OnReadyApplication action flow . 

UserImage.jpg
Annish J K

I tried using js 

var script = document.createElement('script');

script.src = "https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js"

document.head.appendChild(script);console.log(script)

var script2 = document.createElement('script');

script2.src ="https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js";

document.head.appendChild(script2);console.log(script2)



UserImage.jpg
Shamshad Akther

when is the firebase initialized? This error shows its tried to be invoked before script is imported properly.

firebase.initializeApp({ /* Firebase config */ }) must be called after the script is imported.

One option:

1. Use JS to import the scripts onReadyApplication action flow.

2. initialize and use firebase onReady action flow of block/page. 

UserImage.jpg
Annish J K

no ,when I click on Send OTP button sendotp screen action will run that is where the firebase.initializeApp js code is there


2022-08-03 04-32-50
Ravi Punjwani

Hi Annish,

In your previous reply I can't see anywhere mentioned about script.type = 'module'

Can you confirm if you've tried that option already (as I saw on your screenshot in the original post description)?

Also I can't see where are you adding that script, is it inside OnReady or OnInitialize of your screen/webblock. If possible, please share your oml file.

UserImage.jpg
Annish J K
FormValidationsExercise.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.