FormidableLabs / react-native-app-auth

React native bridge for AppAuth - an SDK for communicating with OAuth2 providers
https://commerce.nearform.com/open-source/react-native-app-auth
MIT License
2.04k stars 441 forks source link

Problems setting redirectUri using Expo #957

Closed cr1337-sudo closed 3 months ago

cr1337-sudo commented 7 months ago

Issue

-- SPOTIFY LOGIN -- Hi there. I'm using react native with Expo and I'm facing a problem when I have to redirect after he clicks the 'Agree' button. I'm not quite sure about what url should I use, according to a few StackOverflow questions I should use the redirect uri 'exp://192.168.1.2:8081/--/spotify-auth-callback'

This is my spotifyConfigthat I'm using to initiate the login:

this.spotifyAuthConfig = {
            clientId: 'CLIENT-iD',
            clientSecret: 'CLENT-SECRETI,
            redirectUrl: 'exp://192.168.1.2:8081/--/spotify-auth-callback',
            scopes: [
                'playlist-read-private',
                'playlist-modify-public',
                'playlist-modify-private',
                'user-library-read',
                'user-library-modify',
                'user-top-read',
            ],
            serviceConfiguration: {
                authorizationEndpoint: 'https://accounts.spotify.com/authorize',
                tokenEndpoint: 'https://accounts.spotify.com/api/token',
            },
        };

I'm using the same redirectUri in my Spotify Project Configuration.

Environment

zibs commented 3 months ago

I think you'll want to take a look at https://docs.expo.dev/versions/latest/sdk/auth-session/#usage-in-standalone-apps for how to set a redirect URI scheme using Expo.