Issue
I am building an in-app browser for handling firebase authentication with external providers (for example Microsoft login).
I have button in my main page which calls auth.startActivityForSignInWithProvider(this, provider).addOnSuccessListener{}
and it launches the activity with a webview.
The issue is once I finish completing the login with the provider, the webview receives an intent url (which is a string and showcased below). But the webview is not able to load and I get Webpage not available with ERR_UNKNOWN_URL_SCHEME error.
How can I parse this string into an intent in-order to launch it?
intent://firebase.auth/#Intent;scheme=genericidp;package=uk.co.***.***;S.authType=signInWithRedirect;S.eventId=bb96c23e7d-83ed-4b2f4-a738c-8af24f53daac4a;S.link=https%3A%2F%2Fmyfirstapp.firebaseapp.com%2F__%2Fauth%2Fhandler%3Fcode%3D0.AYIAvV-YJWoeZ6UOoRJEOjketivqfgizchdL5MitfLanIqQUbaCAAA.AQABAAIAAAD--DLA3VOs37Qrdd3gJg7Wevrer7Hj2PDEVXa5M0c_i8Fmje0dCOSg-e2xcTuMO2u3tm4ylmtm1tQ5aUqpwvjYuQZckOik3baj4ag9wWloW503BiFxxHCYOy4YhB9x5DQgPJvYx2AQutoy0PVzo9C0HiiX2CjLTfVARrRh5S-IiQ_I7lZrkVtLMxl7LKnw6gGsMV78V-F9odBnYOSNOXDuZQfbpqbIFFDg7Bi1DdbF98SIpSZDtm_uOS5b-LrZAdbgopwHs2g9mGZB4txTSTuQlXYDS-KaKaGUS5aIPdO2oFF32nikBH2FRj4ClOqNmuoVsBK79y4iFSYBA4y0L2gkC3221wxDJMIbt5CQ82NoqtOg6LxEcznIfO9aGxDdY51FpNDlDUmffkz-6RrZa96fcF_5W6KLx3QSjAB044Wg73xmnx4CGp2iD2QQA6rP46v6VcwvA4kv5bdMUxoR9r6awlkY4wL0Dv8pe_85yX-7XT3vD2XtkC0I14_kKXB6TIAYrdMvMcR46ln9XTUAJA6oeZ63_iqdXeTl-HA51NwrzSfC5-5apTEWa6mnGtDnK2J45Fkn5WTvSN9kRYxEvrmm-GCM01J_iLtIerPd4GpcVmrZf-lAnUjqTM_h3CTaOf6EP52G7NdNa7-tYQReDy2hrJT2M37iUPaqcSZt2xmwX8zcgfUF5jDXyj3VltheP_cwiAA%26state%3DAMbdmDl8cIpde-NI1OK041xo63TwUfTRG-l6ojKgdKCrrd_uVaM0fO1H53zxbRYLig7qpwRXB6YyKzx5uLjR59UHkH1WKKL0MGtn4m-aU0YpZECef84BTh35JhvPoVikx0cJZdIZtgZcnE-cgh8WmGaT58cWPgmJvUznhP3H2exybOdT49CniTDko2-1uzL4zjibTqD223s54Ij3BX-Cbpzw_A6WS-PDGUhyKPtm7QzKs3oKOR7dZ9xA97lv5ESe8Lpk2hh9weiyfZ99FQpaUYlEyROIFWq79p_prE_8Kp2kJEr1p9zXox4QUS874-_WOmZDizJxKXFdbV0TxJbrKGfqFdXCtHUDmEMRgEugsyxvQ2NRCfeJDwcMbWhKFdQeH36wSs1zHZb14uQ3V5eH1MwEtY%26session_state%3De6521ed7-c1ed-4459-bb7e-e97da47be881;B.encryptionEnabled=false;S.browser_fallback_url=https%3A%2F%2Fmyfristapp.firebaseapp.com%2F__%2Fauth%2Fhandler;end;
Solution
Just had to parse the intent uri like this
val intent = Intent.parseUri(urlStr, Intent.URI_INTENT_SCHEME)
startActivity(intent)
Answered By - Aryinak
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.