Platform

Sign Up With Instagram

9min

Instagram OAuth Tutorial

Introduction

Instagram OAuth enables users to sign in to Apps using their Instagram account through OAuth.

Prerequisites

To complete this tutorial, you will need:

1 - Create a New Back4App App

First of all, itโ€™s necessary to make sure that you have an existing app created at Back4App. However, if you are a new user, you can check this tutorial to learn how to create one.

2 - Create a new Instagram App Client

Log into your Instagram Developer account and sign up as a Developer. Enter your website, telephone, and a description for your App. Accept the terms to proceed.

Document image
๏ปฟ

Go to Overview. Click on Register Your Application๏ปฟ

Document image
๏ปฟ

Click on Register a New Client๏ปฟ

Document image
๏ปฟ

Fill up the Application Name, Description, Company Name, Website URL, Redirect URIs, Privacy Policy URL, and Contact email.

For the Valid redirect URIs, if you are only trying to retrieve your access token, you can leave it as

http://localhost

Otherwise, you should use the production URI for redirection

Document image
๏ปฟ

At this point, you should have a Client like the image below

Document image
๏ปฟ

Click on Manage and under the Security tab, uncheck the Disable Implicit OAuth๏ปฟ

Document image
๏ปฟ

3 - Retrieve your Token

If you left your Redirect URIs as localhost, there are two ways you can retrieve your token. The first one is using your Browser of choice, and going to the following URL:

just change the CLIENT-ID and REDIRECT-URI using the values you got from your newly created Client. This will redirect you to an invalid page, but show you the access token in the URL:

Document image
๏ปฟ

The other way to retrieve such a token is to run the following CURL command, replacing the CLIENT-ID, CLIENT-SECRET, and REDIRECT-URI for your values:

Curl
๏ปฟ

That command will also output your Access Token.

4 - Start the development

Now that the Sign In with Instagram is configured, you can start the development process passing the Access Token you retrieved for authentication. The format for AUTHDATA is:

JSON
๏ปฟ

Here is the method for the iOS SDK:

Swift
๏ปฟ

And here for the Android SDK:

Java
๏ปฟ

๏ปฟ