Skip to content
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

Develop WebJS SDK for Frequency Login #232

Open
p5150j opened this issue Sep 19, 2024 · 1 comment
Open

Develop WebJS SDK for Frequency Login #232

p5150j opened this issue Sep 19, 2024 · 1 comment

Comments

@p5150j
Copy link
Collaborator

p5150j commented Sep 19, 2024

Develop WebJS SDK for Frequency Login

Summary:

As a developer, I want to build a WebJS SDK for web apps to integrate the "Sign In with Frequency" button, so users can authenticate directly from the browser.

Acceptance Criteria:

  • Create a WebJS SDK that enables rendering and configuration of the sign-in button.
  • Implement logic to handle the authentication flow via the browser without requiring an embedded browser.
  • Capture the authorization code after successful authentication and pass it to the web app backend.
  • Provide clear documentation for integrating the SDK into web applications.

Pseudocode for WebJS (JavaScript):

// Import the Frequency SDK (via npm or CDN)
import FrequencySDK from 'frequency-sdk';

// Initialize the Frequency button
const frequencyButton = FrequencySDK.createSignInButton();
document.getElementById('button-container').appendChild(frequencyButton);

// Configure the button with params and URLs
FrequencySDK.configureButton(frequencyButton, {
    params: someParams,
    authenticationUrl: someUrl
});

// Handle sign-in result
FrequencySDK.onSignInComplete((result) => {
    if (result.success) {
        console.log("User ID:", result.user.id);
    } else {
        console.error("Sign-in failed:", result.error.message);
    }
});

// In your backend API callback handler
FrequencySDK.handleCallback(window.location.href);
@wilwade wilwade transferred this issue from ProjectLibertyLabs/gateway Dec 3, 2024
@wilwade wilwade added the SDKs label Dec 3, 2024
@wilwade wilwade added this to the Enhance SIWF Usage with SDKs milestone Dec 3, 2024
@claireclark1
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants