Community Addition Use Issue
-
I have logged into my account but i didn't get any company id or secret ID for implementation purpose so please provide required steps to accomplish this
-
@max-0 can you elaborate further? Are you trying to call the application inside of FusionAuth that you have setup?
To find the
clientId
and use it to set up OAuth in a Node.js application with FusionAuth, you will typically go through the following steps:-
Create an Application in FusionAuth: You need to create an application within the FusionAuth admin UI. During the creation process, FusionAuth will automatically generate a
clientId
and aclientSecret
for your application. These credentials are used to identify your application to the FusionAuth server. -
Record the
clientId
andclientSecret
: After creating the application, you should record theclientId
andclientSecret
provided by FusionAuth. These will be used in your Node.js application to authenticate with the FusionAuth server. -
Configure OAuth in Your Node.js Application: In your Node.js application, you will need to configure the OAuth flow. This typically involves setting up routes and using the
clientId
andclientSecret
to exchange an authorization code for an access token.
Here is an example of how you might set up the OAuth flow in a Node.js application using the
clientId
andclientSecret
:const express = require('express'); const router = express.Router(); const { FusionAuthClient } = require('@fusionauth/typescript-client'); // Replace these with the values you recorded from FusionAuth const clientId = 'your-client-id'; const clientSecret = 'your-client-secret'; const client = new FusionAuthClient('noapikeyneeded', 'http://localhost:9011'); const loginUrl = 'http://localhost:9011/oauth2/authorize?client_id=' + clientId + '&response_type=code&redirect_uri=http%3A%2F%2FyourRedirectUriHere&scope=offline_access'; const logoutUrl = 'http://localhost:9011/oauth2/logout?client_id=' + clientId; // Define your routes here // ... module.exports = router;
In the above code, replace
'your-client-id'
and'your-client-secret'
with the actualclientId
andclientSecret
you obtained from FusionAuth. Also, replace'http://yourRedirectUriHere'
with the redirect URI configured in your FusionAuth application settings.For more detailed instructions and examples, you can refer to the FusionAuth documentation and blog posts that discuss setting up OAuth in Node.js applications:
- Modern Guide to OAuth
- Single Sign-On (SSO) with FusionAuth
- Securely Implement OAuth in React
- Create a Node.js Application with FusionAuth Support
- Setting Up Single Sign-On for NodeBB
- Using OAuth and PKCE to Add Authentication to Your Gatsby Site
Remember to keep your
clientSecret
secure and never expose it in client-side code or public repositories. -