ProjectLibertyLabs/gateway

Develop React Native SDK for Frequency Login

Opened this issue · 0 comments

p5150j commented

Develop React Native SDK for Frequency Login

Summary:

  • As a developer, I want to build a React Native SDK for cross-platform apps that simplifies adding the "Sign In with Frequency" button, so users can authenticate via Frequency on both iOS and Android.
  • Acceptance Criteria:
  • Create a React Native SDK that renders and configures the sign-in button.
  • Implement logic to launch an embedded browser or WebView for authentication.
  • Handle the callback URL with the authorization code and pass it to the app backend.
  • Provide example documentation for integrating the SDK in React Native apps.

Pseudocode for React Native (JavaScript):

// Import the FrequencySDK for React Native
import { FrequencyButton, FrequencySDK } from 'react-native-frequency-sdk';
import React from 'react';
import { View } from 'react-native';

const SignInScreen = () => {

    const handleSignInComplete = (result) => {
        if (result.success) {
            console.log("User ID:", result.user.id);
        } else {
            console.error("Sign-in failed:", result.error.message);
        }
    };

    const signIn = () => {
        FrequencySDK.configureButton({
            params: someParams,
            authenticationUrl: someUrl
        });

        FrequencySDK.onSignInComplete(handleSignInComplete);
    };

    return (
        <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
            {/* Render Frequency Sign In Button */}
            <FrequencyButton 
                onPress={signIn}
                style={{ width: 200, height: 50 }}
            />
        </View>
    );
};

export default SignInScreen;