react-native-app-auth | React native bridge AppAuth - an SDK | OAuth library

 by   FormidableLabs Java Version: 7.1.3 License: MIT

kandi X-RAY | react-native-app-auth Summary

kandi X-RAY | react-native-app-auth Summary

react-native-app-auth is a Java library typically used in Security, OAuth, React Native applications. react-native-app-auth has no bugs, it has no vulnerabilities, it has a Permissive License and it has high support. However react-native-app-auth build file is not available. You can install using 'npm i react-native-app-auth-onsite' or download it from GitHub, npm.

This versions supports react-native@0.63+. The last pre-0.63 compatible version is v5.1.3. React Native bridge for AppAuth-iOS and AppAuth-Android SDKS for communicating with OAuth 2.0 and OpenID Connect providers. This library should support any OAuth provider that implements the OAuth2 spec. We only support the Authorization Code Flow.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              react-native-app-auth has a highly active ecosystem.
              It has 1739 star(s) with 422 fork(s). There are 66 watchers for this library.
              There were 3 major release(s) in the last 12 months.
              There are 122 open issues and 482 have been closed. On average issues are closed in 125 days. There are 10 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of react-native-app-auth is 7.1.3

            kandi-Quality Quality

              react-native-app-auth has 0 bugs and 0 code smells.

            kandi-Security Security

              react-native-app-auth has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              react-native-app-auth code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              react-native-app-auth is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              react-native-app-auth releases are available to install and integrate.
              Deployable package is available in npm.
              react-native-app-auth has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions, examples and code snippets are available.
              react-native-app-auth saves you 498 person hours of effort in developing the same functionality from scratch.
              It has 1397 lines of code, 54 functions and 32 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed react-native-app-auth and discovered the below as its top functions. This is intended to give you an instant insight into react-native-app-auth implemented functionality, and help decide if they suit your requirements.
            • Performs an authorization request .
            • Convert registration response to a map .
            • Converts a JSONObject to a WritableMap
            • Initialize Flipper
            • Convert an authorization code response to a map .
            • Opens a connection to the given URI .
            • Convert end session response to map .
            • Formats a timestamp .
            • Create view managers .
            • Returns the main component name for this example .
            Get all kandi verified functions for this library.

            react-native-app-auth Key Features

            No Key Features are available at this moment for react-native-app-auth.

            react-native-app-auth Examples and Code Snippets

            No Code Snippets are available at this moment for react-native-app-auth.

            Community Discussions

            QUESTION

            Questions about Native applications and openId Authorization code flow
            Asked 2022-Feb-14 at 14:27

            I have a few concerns with an OpenId Connect strategy that I would like to use and have been unable to find specifics on what the security concerns may be and any glaring issues with it I am overlooking.

            Currently, I have an OpenId Connect implementation using Openiddict with Authorization Code flow. For the client, I have a React-Native app using react-native-app-auth.

            I see from other questions on SO and from issues posted on the Openiddict repo that the recommended approach to third-party providers (e.g. Google) is: Client -> Auth server -> Google Auth -> Auth server -> Client/Auth server code and token exchange

            However, it seems that a better approach from a UX standpoint (when using a SPA or native app) would be to implement something similar to GoogleSignIn on the client and either handle the identity on the server using an IdToken or authorization code from Google. This introduces an issue as the flow previously recommended could not be used as the entire initial challenge and redirect from Auth server to Google Auth has been skipped.

            I have seen that this issue is mitigated by not using the authorization code grant and instead implementing a custom assertion grant. This seems to be an alright approach but would require exposing a custom grant and handling the flow differently on the client and server for local and third-party logins.

            My proposed solution continues to use the authorization code flow and instead of adding a custom grant type the client could just pass a third-party identifier "Google" and the token or authorization code in the additional parameters of the OIDC authorize request. The authorize endpoint could then detect the provider and token, perform token validation, create a user or principal from it, and create an authorization code to send back to the client for the code/token exchange. This flow would look like the following:

            1. Get the id token from the provider Client -> GoogleSignIn -> Client

            2. Pass token to auth server and initiate code / token exchange Client -> Auth Server -> Auth server Verify Google IdToken (JWKS, issuer, audience, provider specific validation, etc...) or exchange auth code -> Auth server -> Client/Auth server code and token exchange

            One downside to this approach would be the additional hops to verify the token on the server side. If the token was returned from GoogleSignIn, they themselves said that it could be trusted. https://developers.google.com/identity/protocols/oauth2/openid-connect#obtainuserinfo

            I see that it is generally recommended to place the auth server between the client and the third-party but in this process the server is still between the client and auth server but only after the initial exchange from the client and third-party.

            Questions,

            1. In general am I missing something with this flow?

            2. In this case would it be necessary to verify the token on the server side?

            3. Is there some better way to approach this that I have completely overlooked?

            4. Am I making this too complicated and UX should not be this much of a concern?

            5. Instead of adding the provider and token to the additional parameters would it make more sense to pass it in the body of a post request? I don't see the issue with passing it via query string but that's also part of the reasoning for the authorization code grant from my understanding.

            Apologies in advance for anything I have missed or omitted for brevity that should have been included.

            Thanks.

            ...

            ANSWER

            Answered 2022-Feb-14 at 14:27

            ARCHITECTURE

            I'm not sure I understand the UX problem - your existing architecture feels really good. If you want to login directly to Google, just send an acr_values=google query parameter in the authorization redirect, to bypass any authentication selection screens. The exact value will depend on how Openiddict represents the Google authentication option, and some providers use a non-standard parameter such as idp. Have a closer look at the OIDC request parameters.

            A key OAuth goal is that the Authorization Server (AS) - Openiddict in your case - shields your apps from all of the provider differences and deals with their nuances and vendor specific behaviour. Your apps then also only receive one type of token, and only ever use simple code. As an example, the Curity AS supports all of these options, none of which requires any code in applications.

            APPAUTH AND UX

            If a user is already signed in then it can, as you say, look unnatural to spin up the system browser and them it is dismissed immediately.

            A common option is to show the consent screen or an interstitial page to keep the user informed - and the user clicks one extra button. This can also be useful for getting password autofill to work. My code example and blog post shows how this might look, though of course you can improve on my basic UX.

            OFFLINE ACCESS

            I find this term misleading, since refresh tokens are most commonly used when the user is there. Are you just asking how to deal with tokens in a mobile client? Aim for behaviour like this:

            • Standard messages for API calls with access tokens in an authorization bearer header
            • Standard refresh token grant messages to refresh access tokens - eg as in this code

            Note also that mobile apps can save tokens to encrypted secure mobile storage that is private to the app. This can improve usability, eg by avoiding logins every time the app is restarted. You should think through scenarios such as stolen devices and token lifetimes though.

            Source https://stackoverflow.com/questions/71043136

            QUESTION

            Use Keycloak with react native
            Asked 2020-Aug-27 at 15:31

            I'm developing an app for ios and android in react native and need to use keycloak for authorization, but struggling to find a good way.

            I've tried react-native-app-auth and it works good to sign in but not to sign out. Not so strange because react-native-app-auth states that: "Keycloak does not specify a revocation endpoint so revoke functionality doesn't work."

            I've had a look at a few other npm packages such as react-native-login-keycloak but they seem to lack maintenance and opens a lot of browser tabs.

            Any ideas of how to solve this or maybe do a work-around for react-native-app-auth? Thank you for your help!

            ...

            ANSWER

            Answered 2020-Jun-04 at 17:17

            Check the openid-connect configuration endpoint.

            You can find it in your keycloak server

            https://{your-keycloak-server}/auth/realms/{your_realm}/.well-known/openid-configuration

            you will find the endpoints for:

            authorization_endpoint token_endpoint end_session_endpoint

            Add those to your react-native-app-auth configuration.

            Source https://stackoverflow.com/questions/62133316

            QUESTION

            What is the RedirectURL in react-native-app-auth - and how do I get back to my app?
            Asked 2020-Jul-06 at 18:57

            I'm a noob in the world of React-Native development and am trying to work out how to configure FormidableLabs' react-native-app-auth plugin so that a user of our app can sign in to our Identity Server 4 implementation and then return to the app.

            I can get to the sign-in form easily enough - but after signing in it goes to another Identity Server page in the browser rather than back to the app. I assume this is because of a wrong configuration, but I've searched the net far and wide for an answer that actually explains what the redirectUrl should actually point to - in all the examples it just points to io.identityserver.demo:/oauthredirect. Is it possible to redirect back to an app?

            What I've also noticed is that the original request to the login page does not pass it a ReturnUrl - that parameter is null.

            I feel I'm missing something obvious here, but I cannot think what it is.

            Here's the relevant code from the app:

            ...

            ANSWER

            Answered 2020-Jul-05 at 17:26

            You are on the right track, once the user has logged into IdentityServer it will redirect back to redirectUrl.

            I suggest you to read the docs as it has it explained with example code.

            Source https://stackoverflow.com/questions/62735277

            QUESTION

            Deep linking working with adb, not in browser
            Asked 2020-Feb-11 at 18:34

            I have setup deep linking in my app previously and had it work just fine. All the sudden it stops working. I have the below manifest...

            ...

            ANSWER

            Answered 2020-Feb-11 at 18:34

            The reason for not able to redirect while typing/pasting URL in your browser is due to a bug in Chrome browser itself. but that turned out to be an functionality and adopted by some other browsers as well

            You can check the bug here, and look at the status: WontFix (Closed).

            Now the reason behind all this according to them,

            If a user typing/pasting URL in browser then the user really want to go that URL, instead being redirected on a application

            So your deep linking is working fine, best way to test it, share the link and then click on it

            And also this always redirection really caused problem as well, when user was not able to go on the website due to redirection, you can also check a bug report here due to this always redirection, status is now Fixed (Closed) for it

            Source https://stackoverflow.com/questions/60165789

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install react-native-app-auth

            To setup the iOS project, you need to perform three steps:. This library depends on the native AppAuth-ios project. To keep the React Native library agnostic of your dependency management method, the native libraries are not distributed as part of the bridge. AppAuth supports three options for dependency management.
            Install native dependencies
            Register redirect URL scheme
            Define openURL callback in AppDelegate
            CocoaPods cd ios pod install
            Carthage With Carthage, add the following line to your Cartfile: github "openid/AppAuth-iOS" "master" Then run carthage update --platform iOS. Drag and drop AppAuth.framework from ios/Carthage/Build/iOS under Frameworks in Xcode. Add a copy files build step for AppAuth.framework: open Build Phases on Xcode, add a new "Copy Files" phase, choose "Frameworks" as destination, add AppAuth.framework and ensure "Code Sign on Copy" is checked.
            Static Library You can also use AppAuth-iOS as a static library. This requires linking the library and your project and including the headers. Suggested configuration: Create an XCode Workspace. Add AppAuth.xcodeproj to your Workspace. Include libAppAuth as a linked library for your target (in the "General -> Linked Framework and Libraries" section of your target). Add AppAuth-iOS/Source to your search paths of your target ("Build Settings -> "Header Search Paths").
            CFBundleURLName is any globally unique string. A common practice is to use your app identifier.
            CFBundleURLSchemes is an array of URL schemes your app needs to handle. The scheme is the beginning of your OAuth Redirect URL, up to the scheme separator (:) character. E.g. if your redirect uri is com.myapp://oauth, then the url scheme will is com.myapp.
            swift-Bridging-Header.h should include a reference to #import "RNAppAuthAuthorizationFlowManager.h, like so:
            AppDelegate.swift should implement the RNAppAuthorizationFlowManager protocol and have a handler for url deep linking. The result should look something like this:
            Note: for RN >= 0.57, you will get a warning about compile being obsolete. To get rid of this warning, use patch-package to replace compile with implementation as in this PR - we're not deploying this right now, because it would break the build for RN < 57.

            Support

            See Usage for example configurations, and the included Example application for a working sample. This is the main function to use for authentication. Invoking this function will do the whole login flow and returns the access token, refresh token and access token expiry date when successful, or it throws an error when not successful. ANDROID This will prefetch the authorization service configuration. Invoking this function is optional and will speed up calls to authorize. This is only supported on Android. This is your configuration object for the client. The config is passed into each of the methods with optional overrides.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i react-native-app-auth

          • CLONE
          • HTTPS

            https://github.com/FormidableLabs/react-native-app-auth.git

          • CLI

            gh repo clone FormidableLabs/react-native-app-auth

          • sshUrl

            git@github.com:FormidableLabs/react-native-app-auth.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular OAuth Libraries

            satellizer

            by sahat

            cpprestsdk

            by microsoft

            oauth2-server

            by thephpleague

            scribejava

            by scribejava

            socialite

            by laravel

            Try Top Libraries by FormidableLabs

            webpack-dashboard

            by FormidableLabsJavaScript

            victory

            by FormidableLabsJavaScript

            spectacle

            by FormidableLabsTypeScript

            radium

            by FormidableLabsJavaScript

            urql

            by FormidableLabsTypeScript