Table of contents


Unofficial Content

This article explains how to authenticate your users with Instagram using GeneXus Access Manager (GAM).

You need to use OAuth 2.0 Authentication Type and do some configurations on both sides:  Meta for Developers portal and GAM's backend.

Configuration on the Meta for Developers portal

1. Go to https://developers.facebook.com/apps/ and click on "Create Application".

2. Go to "Set Up" under the Develop your app panel, and click on "Basic Information".

3. Add your redirect URIs, for example, https://domain/base-url/oauth/gam/callback

Note: Leave all the other default values.

4. Go to the "Panel" option in the right panel and in "Add a Product" choose Instagram Basic Information > Configure.

5. Click on "Create New App".

6. Save your App ID and the Secret Key.

7. Add a Redirect URI, Deauthorize URL, and User Data Deletion URL.

Redirect URI : https://domain/base-url/oauth/gam/callback

8. Finally, go to Application Roles and add a Developer.

Important note

If you get an error message like the following:

{
"error_type": "OAuthException",
"code": 400,
"error_message": "Insufficient developer role"
}

Follow this link to see how to solve it.

Configuration in the GAM Backend

1. Enter the GAM Backend and go to the Authentication Types section. Create a new OAuth 2.0 Authentication Type and define basic information in the General section: Name, Description, Images (optional), etc.

2. In the Configuration section, you need to define the following for the General, Authorization, Token, and User Information tabs:

General tab

Client ID:     client_id        Value: <clientid>
Client Secret: client_secret    Value: <clientsecret>
Redirect URL:  redirect_uri     Value: https://<server>/webapp (ie.  https://gamidentityprovider.com/v15_IPServerNetSQL)

Authorization tab

URL: https://api.instagram.com/oauth/authorize
Response type: response_type    Value: code
Scope:         scope            Value: basic
State:         state
Include ClientID and RedirectURL
Response:
Access code TAG: code
Error description TAG: error_description

Token tab

URL: https://api.instagram.com/oauth/access_token
Header Cotent type: Content-type    Value: application/x-www-form-urlencoded
Grant type:         grant_type      Value: authorization_code
Include All
Response:
Access token TAG: access_token
Token type TAG: token_type
Expires in TAG: expires_in
Refresh Token TAG: Not available for this Provider. When the token expires, it cannot be refreshed.
Error description TAG: error_description
Validate external token = True  // When the token expires, the GAM session ends.
Refresh token URL = leave it empty. Uses the same URL used to ask for a Token.

User Information tab

URL:  https://api.instagram.com/v1/users/self
Method: Get
Header Content type: Content-type    Value: application/json;charset=utf-8
Do not include anything.
Email TAG:
External ID TAG: id
Name TAG:  username
First name TAG: full_name
Generate automatic Last name : True
Birthday TAG: birthday
URL image TAG: profile_picture
Error description TAG: error_description 

Availability

Since GeneXus 15 Upgrade 11

See Also

GAM - OAuth 2.0 Authentication Type

    

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant