question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue

I tried to create a react native app with OAuth Login in my Rails app.

I have this react native setup

const config = {
  issuer: 'http://app.domain.tld',
  clientId: '85bb84b9cb0528b1f64b7c77586507b3ca5e69b11abe36ae1e54e88a6150c21e',
  clientSecret: '0d3c0713437e0028a121a0c2294cc9a72f4eb5609416935a2860e20f176c7855',
  redirectUrl: 'com.domain://com.domain',
  responseType: 'code',
  scopes: [],
  dangerouslyAllowInsecureHttpRequests: __DEV__,
  // clientAuthMethod: 'post',
  serviceConfiguration: {
    authorizationEndpoint: 'http://app.domain.tld/oauth/authorize',
    tokenEndpoint: 'http://app.domain.tld/oauth/token',
    // revocationEndpoint: 'http://app.domain.tld/oauth/revoke'
  },
  additionalParameters: {
    approval_prompt: 'force'
  }

}

// use the client to make the auth request and receive the authState
try {
  const result = await authorize(config)
  // result includes accessToken, accessTokenExpirationDate and refreshToken
  console.log('result', result)
} catch (error) {
  console.log('error', error.message)
}

the oaut app looks like this: image

When I press the button to login in my app, I get a browser window where I can login in my rails app and got redirected to the authorize page for the oauth app. After I authorize my app, I got redirected to the app with the message “Network error”. With that message I can’t find out whats wrong, maybe anyone can help me.

In the server logs I can see this:

Redirected to com.domain://com.domain?code=54f3b4c03ea3724522f9a7983e2ea1b9037336076cd52cb875f9654d5d79784a&state=8xmiicVcPKN980ZDZUwBnw

in the debugger-ui i got this:

error Error: Network error
    at createErrorFromErrorData (ReactNativeART.js:10)
    at ActivityIndicator.js:72
    at MessageQueue.__invokeCallback (ReactNativeART.js:472)
    at blob:http://localhost:8081/1fccf34b-97b0-4c42-81fa-f0e1391a3ad3:2358
    at MessageQueue.__guard (ReactNativeART.js:373)
    at MessageQueue.invokeCallbackAndReturnFlushedQueue (blob:http://localhost:8081/1fccf34b-97b0-4c42-81fa-f0e1391a3ad3:2357)
    at debuggerWorker.js:80

so i think there is something wrong. The app didn’t make any further request to the server to obtain the access_token. Whats wrong?


Environment

  • Your Identity Provider: RailsApp with Doorkeeper
  • Platform that you’re experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • Are you using Expo, e.g. ExpoKit?
    • No
    • Yes, I’ve not ejected
    • Yes, but I have ejected to ExpoKit
    • Yes, but I have ejected to vanilla React Native

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
itolegmysincommented, Mar 27, 2019

Hi @Electrofenster, try to use serviceConfiguration: { authorizationEndpoint: string; tokenEndpoint: string; } instead issuer in the config.

1reaction
tomjojcommented, Apr 7, 2022

use in config dangerouslyAllowInsecureHttpRequests: true,

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is a “Network Error” and how do I resolve it?
If the error is only occurring on your computer, please disconnect from your internet connection for sixty seconds and then re-connect. Taking ...
Read more >
5 Common Network Errors & How to Fix Them - MakeUseOf
1. Problems With Your DNS · 2. VPN Connection Issues · 3. Conflict of IP Address · 4. Unplugged Network Cables · 5....
Read more >
Network Error Logging - HTTP - MDN Web Docs
Network Error Logging is a mechanism that can be configured via the NEL HTTP response header. This experimental header allows web sites and ......
Read more >
Fix connection errors - Google Chrome Help
If you go to a website and get an error, try these troubleshooting steps first: Check the web address for typos. Make sure...
Read more >
OpenAI ChatGPT gives network error at long responds. How ...
I resolved it by asking it to show me the first 10-20 lines, then the next 10 and so on until the end....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found