Is there any sample code with custom connector, using OAuth2 authentication?

I found some limitation of existing Rally connector, and trying to explore if a custom connector can be built to help me through.  But I'm behind SSO and not familiar with that layer, so need some help to get over the authentication step first.  Is there anyone in the community who can give me some sample code?

 

Thanks,
Hua

Best Answer

  • kamuela
    kamuela Domo Employee
    Answer ✓

    Hua, if you login to the Connector Dev studio (https://developer.domo.com/builder) using your Domo credentials, we have recently added a sample Facebook connector that uses OAuth for authentication.  We will also be adding it to the documenation on the developer portal in the next week or so.

     

    Thanks,

    Sam

     

     

    I am no longer with Domo. Please @mention @Millhouse for connector specific questions.

Answers

  • Hi all,

    Can anybody help out @Hua?

    Thanks!

  • Maxamillioo
    Maxamillioo Domo Employee

    Hi @Hua,

    Thank you for reaching out! Currently the best resource for finding information about building custom connectors can be found at developer.domo.com. There you can search through various documentation that may be helpful in what you are trying to accomplish.

    In the mean time, I will also be forwarding your question to a team here that may be able to provide you with additional information.

    Thank you!

    Maxwell

    Dojo User
    **Say "Thanks" by clicking the "heart" in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"
  • kamuela
    kamuela Domo Employee
    Answer ✓

    Hua, if you login to the Connector Dev studio (https://developer.domo.com/builder) using your Domo credentials, we have recently added a sample Facebook connector that uses OAuth for authentication.  We will also be adding it to the documenation on the developer portal in the next week or so.

     

    Thanks,

    Sam

     

     

    I am no longer with Domo. Please @mention @Millhouse for connector specific questions.
  • Hello,

     

    I do not see the Facebook custom connecter in my builder portal. Was it removed?

  • evanbench
    evanbench Domo Employee

    Looking for sample OAUTH 2.0 script that works. The default Facebook connector is very limited and does not show how to handle requests for authorization code in the logic of the authorization process.

  • Yup, looks like the facebook example has been removed. :(  Anyone still have that sample code?

  • I still see Facebook sample there on my view:

    https://developer.domo.com/builder/#!/edit/4812a950-c949-4bb4-8231-f044651d4c60

     

    Can you see it?  If not, it needs to be raised to DOMO connector support.  Good luck!

  • Not sure about anyone else but I do not have the custom facebook connector app in my list in builder. Domo support was nice enough to send me the sample auth code. See below. 

     

    /*
    If you do not already have a Facebook App then you will need to create one to use this example connector. You can do this by registering a new app at https://developers.facebook.com/quickstarts/.The domain to register for the "Site URL" of the Facebook app is "developer.domo.com". After you create a new app, go to the Basic settings and configure "developer.domo.com" as an "App Domain".
    Next, you need to enter the Client Key and Client Secret here. The "Client Key" should be your Facebook "App ID" and the "Client Secret" should be your Facebook "App Secret". You can find both of these in the Settings of the new app that you create.

    Your fields should be configured as follows:
    1. Client Key should be the App ID from your new Facebook app.
    2. Client Secret should be the App Secret from your new Facebook app.
    3. Authorization URL should be https://www.facebook.com/dialog/oauth4. Additional Authorization Parameters (Optional) can be left blank.
    5. Access Token URL should be https://graph.facebook.com/oauth/access_token6. Access Token Request Method should be POST
    7. Additional Access Token Parameters (Optional) can be left blank.
    8. Scope should be set to "email" (read more about permissions here: https://developers.facebook.com/docs/facebook-login/permissions#reference-email)
    Once you have filed out the OAuth2.0 form to the right, click "Get Access Token", log in to Facebook, and check the DOMO.log output to see if OAuth2.0 authentication was successful.
    For other questions, please see https://developers.facebook.com/docs/facebook-login for more information*/

    //All code below this point will only execute when "Run Script" is clicked. You must have successfully received an Access Token from Facebook first by clicking "Get Access Token"

    //These two lines print the Facebook Auth Code and Facebook Access Token, respectively, for reference.DOMO.log('metadata.account.code: ' + metadata.account.code);
    DOMO.log('metadata.account.accesstoken: ' + metadata.account.accesstoken);

    //Add the access token from Facebook to the HTTP Headers. Some examples are given here: https://developers.facebook.com/docs/workplace/account-management/api
    httprequest.addHeader('Authorization', 'Bearer ' + metadata.account.accesstoken);

    //Make a request using the Access Token to get the user name and ID of the user who successfully authenticated with OAuth2.0.//Since scope was set to "email" we should also get the email address in the users profile, if there is one.var res = httprequest.get('https://graph.facebook.com/v2.5/me');

     

  • @Millhouse Please see above.

    Thanks!

  • I accidently saved over my facebook example connector; is there a way to get it reset?  Maybe post it to the developer section examples like the rest?

This discussion has been closed.