-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make providers support react native #1286
Conversation
fac73ed
to
eabf6f6
Compare
🎉 🥇 Awesome! Will this work if we use WebView for auth only? I guess yes, we get the token in the storage that can be used without WebView, directly in RN environment, right? |
@arturi I have updated the PR so that the URL will contain the |
@@ -422,7 +422,7 @@ module.exports = class ProviderView { | |||
} | |||
|
|||
handleAuth () { | |||
const authState = btoa(JSON.stringify({ origin: location.origin })) | |||
const authState = btoa(JSON.stringify({ origin: location.origin, redirect: 'http://localhost:3' })) | |||
const link = `${this.provider.authUrl()}?state=${authState}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://localhost:3
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's not meant to be there. Removed
Awesome news! Tested, seems to work with the browser. I’d need it merged in master, so I can easier test in RN branch. Left a small comment. |
…ative Make providers support react native
Providers can be instantiated with a
storage
module that behaves similarly tolocalStorage
hereThe auth URL can also be called similarly as done here, but with an additional
redirect
option specified. Like so:If this is done on react-native (on the same window, not a new one), Companion will redirect to the redirect value set after the OAuth dance is done with a
uppyAuthToken
query param passed.