Skip to content

Latest commit

 

History

History
30 lines (23 loc) · 1.02 KB

File metadata and controls

30 lines (23 loc) · 1.02 KB

Reddit

** This is Android Only **

Log in and go to apps to create your app.

Choose "installed app" and give it a name, description and about url of your choosing.

For the redirect uri, choose something like com.myapp//oauth2redirect/reddit and make sure that you use com.myapp in your appAuthRedirectScheme in android/app/build.gradle.

Reddit requires for you to add a basic auth header to the token request.

const config = {
  redirectUrl: 'com.myapp://oauth2redirect/reddit',
  scopes: ['identity'], // include the scopes you need
  serviceConfiguration: {
    authorizationEndpoint: 'https://www.reddit.com/api/v1/authorize.compact',
    tokenEndpoint: 'https://www.reddit.com/api/v1/access_token',
  },
  customHeaders: {
    token: {
      Authorization: 'Basic <base64encoded clientID:>',
    },
  },
};

// Log in to get an authentication token
const authState = await authorize(config);