Skip to content

Authorize with HTTPS redirect URL (Instagram API) and PKCE support? #928

Description

@GunnarAK

Issue

I'm investigating if it is possible to use this library to login to Instagram Basic Display.

I've got the following setup, but on Android I'm faced with the error JSON deserialization error:

const authResult = await authorize({
  issuer: "https://api.instagram.com",
  clientId: settings.instagram.appId,
  redirectUrl: settings.instagram.redirectUri, // https://...
  scopes: [...settings.instagram.scopes],
  serviceConfiguration: {
    authorizationEndpoint: "https://api.instagram.com/oauth/authorize",
    tokenEndpoint: "https://api.instagram.com/oauth/access_token",
  },
});

Adding the skipCodeExchange: true will get me the authorizationCode similar to what is returned by react-native-instagram-login, but that is not what I'm looking for.
The developer responsible for the backend refuses to implement a POST request to https://api.instagram.com/oauth/access_token with the client_secret attached, and instead redirects me to PKCE.

I haven't found any resolutions to configuring app login for Instagram.

Could someone help me get to the bottom of this or give me some definitive answer that PKCE is not supported by the Instagram OAuth API?

And second, how can I make iOS treat my HTTPS redirectUrl properly so it closes the in-app browser?
I have configured Apple Universal Links and Android App Links for deeplinking.

On Android I'm overriding the RedirectUriReceiverActivity to have it capture the authorize() result, but the result is empty.
Debug Mode on Android Studio keeps opening assembly and .h files, so is of no use either.

Errors

iOS

Nothing, the redirect URL is loaded and nothing happens. Browser stays open.

Android

[Error: JSON deserialization error]

Environment

  • Platform that you're experiencing the issue on: both
  • Your react-native Version: 0.72.6
  • Your react-native-app-auth Version: 7.1.0
  • Are you using Expo?: No

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions