Navigating in React native using URL pattern redirection

Implementing facebook and google authentication in my React Native application has been a challenge. The entire process is handled on the server-side with ExpressJS using passport. Upon successful authentication, I aim to redirect with the following URL pattern:

AppName://login?data=somejson

To enable this functionality, I have registered a custom scheme in expo's app.json as outlined in the documentation available at . My JSON configuration appears as follows:

{
  "expo": {
    "name": "My App",
    "slug": "my-app",
    "sdkVersion": "21.0.0",
    "privacy": "public",
    "scheme": "AppName"
  }
}

The guide suggests using a specific link to open the app in Expo development mode which should resemble this:

exp://wg-qka.community.app.exp.direct:80/+

Despite modifying my server code to redirect with the specified pattern above, the desired outcome is still not achieved. Although I can successfully login via the browser, the redirection does not proceed as expected. Even after adding an event listener for this scenario:

exp://wg-qka.community.app.exp.direct:80/login?data=somejson

In my App.js file for React Native, I have implemented the necessary event listener but unfortunately, it does not trigger as anticipated:

Linking.addEventListener('url', this.someFunction);
Linking.getInitialURL().then((url) => {
  // perform certain operations
});

Answer №1

Expo Desktop example

The proper link will automatically appear in your Expo desktop setup, ensuring everything runs smoothly. To check the current linkingUri being used, simply place

console.log(`${Expo.Constants.linkingUri}`)
somewhere during the app initialization process. The documentation may not clarify this clearly, so it took me some time to figure out while using terminal to run my app.

EDIT: Additionally, for authentication purposes, you can utilize the AuthSession component by visiting:

Answer №2

Here is my take on it: exp://wg-qka.@{your-username}.{your-scheme}.exp.direct:80/+

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Troubleshooting: Problems with Encoding and Decoding JSON

I am attempting to establish a connection between a Chrome extension and a PHP file using XMLHttpRequest. It is working fine, but I am having trouble using JSON.parse to decode the JSON. This is my JavaScript file: var client = new XMLHttpRequest(); ...

What causes delayed state updates in React/NextJS until another state is updated or a fast refresh occurs?

UPDATE: Version 13.3.0 is coming soon! In my code, I have a state variable named localArray that I need to update at a specific index. To achieve this, I decided to create a temporary array to make modifications and then set the state with the updated val ...

Tips for utilizing the ng-repeat scope within a nested ng-repeat

I currently have an array of objects structured as follows: expMonthByCat: {Food: [some values], Clothing: [some values] } In conjunction with this data, there exists a table formatted in the following manner: <tr data-ng-repeat="catego ...

Experimenting with applying jquery .slideDown() to multiple classes in order to create dynamic animations

I am facing an issue while using .slideDown() with multiple classes. I want only one class to toggle/dropdown at a time, but currently when I press the button, all classes show up instead of just the one I want to display. How can I achieve this? Here is ...

The process of JavaScript for detecting and extracting text from

After much searching, I stumbled upon this intriguing piece of JavaScript code at this location. Curiously, I was able to remove a few eggs using the following script: var eggCoordinates = []; for (var i = 0; i < 5; i++) { eggCoordinates.push(new E ...

Transferring PHP array to JavaScript with the help of AJAX

I've been working on integrating Google Maps and Instagram in a project of mine. My main challenge is figuring out how to pass the coordinates of Instagram photos from my PHP file to my JavaScript file using AJAX. I'm quite lost when it comes to ...

Flask-SocketIO: Transmitting data between nodes using Redis adapter

When integrating SocketIO into an application running behind a node-balancer, the documentation recommends using SocketIO-Redis to facilitate event passing between nodes: const io = require('socket.io')(3000); const redis = require('socket.i ...

Remove a data entry from the MySQL database by selecting the corresponding row in the table and utilizing the DELETE function

Is there a way to remove a record from my MySQL database by clicking on a row in a table that is generated using ejs? Below is the code I am currently using to generate the table rows. <% res.forEach(function(item){ %> <tr> ...

During my JavaScript coding session, I encountered an issue that reads: "Uncaught TypeError: $(...).popover is not a function". This

Encountering an issue while trying to set up popovers, as I am receiving this error: Uncaught TypeError: $(...).popover is not a function. Bootstrap 5 and jQuery links are included in the code, but despite that, the functionality is still not operational. ...

Automating WhatsApp using Selenium and JavaScript

I've been exploring alternatives to execCommand() since it's no longer recommended, but haven't found a solution that works for me yet. The code below does the job, but I'm wondering if there's a more efficient approach? Here&apos ...

"Placing geotags on the map for every individual location on Google Maps

I am currently using code that was not written by me to generate a Polyline on a Google map based on longitude and latitude entries from my database. It is functioning correctly at the moment. My goal is to enhance it by adding a marker for each location a ...

Executing a script programmatically using an NPM package

I'm in the process of developing a package that relies on an external command tool called plop js. In my package.json, I aim to include a binary that points to an index.js file. "scripts":{ "plop": "plop" }, "bin": { "my-command": "ind ...

The variable that is extracted from a JSON object within an array successfully logs to the console inside a loop. However, when attempting to use the same variable for summation

I have a looping task where I need to add the values of certain objects together in an array. While I can successfully log the values individually, like this: console.log(workouts[0].exercises[0].break); When I try to incorporate them into a loop, I enco ...

Upon clicking outside of the input field, ensure that there is a space added to the

I have these input boxes where integers are entered. My goal is to display them similar to the images below: 1: https://i.sstatic.net/3HUbO.png 2: https://i.sstatic.net/4722H.png $(document).ready(function() { $("input").each(function() { $(th ...

Tips for avoiding unnecessary re-renders when using a functional component and react hooks:

Problem: When a user enters a room code in the input field, the web application re-renders, causing the socket to disconnect and reconnect. Scenario: I am developing a multiplayer game using technologies like Socket.io, React, Express, PostgreSql, and Nod ...

Error in displaying search results due to uncaught violation of invariants

Currently, I am in the process of incorporating search functionality using React. However, there are two main issues that I am facing with my logic flow: The challenge of setting input as Params The difficulty in rendering the data retrieved from the ser ...

Issue on Windows with Selenium WebDriver: logging.js file missing

Currently, I am setting up an automated process in Windows 8.1 using JavaScript with Selenium's WebDriverJS for Chrome automation. After downloading the ChromeDriver and Selenium Standalone Server jar file, I saved them in the E:\Selenium directo ...

Exploring the power of Vue element manipulation

I'm diving into the world of web development and starting my journey with Vue on an online learning platform. Check out the code snippet below: <div id="app"> <form @submit.prevent="onSubmit"> <input v-model="userName"&g ...

What is the best way to include a form within every row of an HTML datatables structure?

I have a regular table that is populated with data fetched via Ajax, and it appears like this: Ajax <script> $(document).ready(function() { $('#mytable').DataTable( { "ajax": "myurl", "dataType": 'json', ...

transferring id values between controllers in angularJS

How can I pass an id from one controller to another in Angular? I have a select menu that allows for selecting a tournament, and upon selection, I want to retrieve the tournament’s _id value in a different controller to query data. Being new to Angular ...